{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1ef9b6bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9e5285f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "sys.path.append(\"/Users/huangzhiming/Documents/python学习/packaging_tutorial/src\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9a86ee7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "sys.path.insert(0,\"/Users/huangzhiming/Documents/python学习/sympy\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "9fdeac5e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['/Users/huangzhiming/Documents/python学习/sympy',\n",
       " '/Users/huangzhiming/Downloads',\n",
       " '/Users/huangzhiming/opt/anaconda3/lib/python39.zip',\n",
       " '/Users/huangzhiming/opt/anaconda3/lib/python3.9',\n",
       " '/Users/huangzhiming/opt/anaconda3/lib/python3.9/lib-dynload',\n",
       " '',\n",
       " '/Users/huangzhiming/opt/anaconda3/lib/python3.9/site-packages',\n",
       " '/Users/huangzhiming/opt/anaconda3/lib/python3.9/site-packages/aeosa',\n",
       " '/Users/huangzhiming/Documents/python学习/packaging_tutorial/src']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sys.path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2883ab76",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload \n",
    "%autoreload 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "ac5967a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "%aimport function_calculator_package.extreme_points\n",
    "%aimport quadratic_function.quadraticfunction \n",
    "%aimport quadratic_function.hyperbola\n",
    "%aimport basic_package.utils\n",
    "%aimport quadratic_function.utils\n",
    "\n",
    "from function_calculator_package.extreme_points import *\n",
    "from quadratic_function.quadraticfunction import QuadraticFunction\n",
    "from quadratic_function.hyperbola import Hyperbola\n",
    "from basic_package.utils import *\n",
    "from quadratic_function.utils import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "694e1be7",
   "metadata": {},
   "outputs": [],
   "source": [
    "%aimport excel_function_package.chi_square_test\n",
    "from excel_function_package.chi_square_test import ChiSquaredTest"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "46558e94",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "1c75ef65",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.calculus.util import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f8f3838a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.stats import E,P,density,FiniteRV,Hypergeometric,Geometric,ChiSquared"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ee7d96cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import x,y,z,k,t,l,m,n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "97d647b3",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.calculus.util import function_range"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c7e02470",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import S"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfbf7cca",
   "metadata": {},
   "source": [
    "### 8月联考"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d3f2754d",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=solveset(2**x<4,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "95698abc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty, 2\\right)$"
      ],
      "text/plain": [
       "Interval.open(-oo, 2)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "eeb14150",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=solveset(x**2-5*x-6<0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "ff4288f2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-1, 6\\right)$"
      ],
      "text/plain": [
       "Interval.open(-1, 6)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "229131cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty, 6\\right)$"
      ],
      "text/plain": [
       "Interval.open(-oo, 6)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A+B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0f379df5",
   "metadata": {},
   "outputs": [],
   "source": [
    "z = symbols(\"z\",complex = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "35c88c48",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "z in Complexes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "67efdf7a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle i \\left(3 - 2 i\\right)$"
      ],
      "text/plain": [
       "I*(3 - 2*I)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(solveset(z*I+3-2*I,z,Complexes))[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "1a7fdf44",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\sqrt{5}$"
      ],
      "text/plain": [
       "2*sqrt(5)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(conjugate(_)-I)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "f0adb19c",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=Matrix([1,2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "7a02b75e",
   "metadata": {},
   "outputs": [],
   "source": [
    "b=Matrix([1,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "52ea445f",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_dict={sin(t):4/S(5),cos(t):3/S(5)}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "824a34a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer1=expand_trig(sin(t+pi/3)).subs(data_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "6e964e17",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{2}{5} + \\frac{3 \\sqrt{3}}{10}$"
      ],
      "text/plain": [
       "2/5 + 3*sqrt(3)/10"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "answer1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "4511a284",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer2=expand_trig(cos(t+pi/3)).subs(data_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "a5bbd792",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{3}{10} - \\frac{2 \\sqrt{3}}{5}$"
      ],
      "text/plain": [
       "3/10 - 2*sqrt(3)/5"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "answer2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "dc768ff2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{7 \\sqrt{3} + 24}{50}$"
      ],
      "text/plain": [
       "-(7*sqrt(3) + 24)/50"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(simplify(2*answer1*answer2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "id": "9983b53f",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=-sqrt(3)*sin(2*x)+2*(cos(x))**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "id": "7b6354b3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\cos{\\left(2 x + \\frac{\\pi}{3} \\right)} + 1$"
      ],
      "text/plain": [
       "2*cos(2*x + pi/3) + 1"
      ]
     },
     "execution_count": 174,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "id": "a31a898a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 175,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "_.subs(x,pi/6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "7331f58f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\cos{\\left(2 x \\right)} + 1$"
      ],
      "text/plain": [
       "2*cos(2*x) + 1"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transfer_function(simplify(expr),x,move=pi/6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "98f3222a",
   "metadata": {},
   "outputs": [],
   "source": [
    "r=1/(sqrt(2)*(1+sqrt(3)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "ec00cd5c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{2}}{2 \\cdot \\left(1 + \\sqrt{3}\\right)}$"
      ],
      "text/plain": [
       "sqrt(2)/(2*(1 + sqrt(3)))"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "2a7d00e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{- 3 \\sqrt{6} + 5 \\sqrt{2}}{12}$"
      ],
      "text/plain": [
       "-(-3*sqrt(6) + 5*sqrt(2))/12"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(simplify(expand(4/S(3)*r**3)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "ff00c98a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 20$"
      ],
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "binomial(6,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "137f7516",
   "metadata": {},
   "outputs": [],
   "source": [
    "c=Circle(Point(1,2),5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "id": "b4404641",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg xmlns=\"http://www.w3.org/2000/svg\"\n",
       "            xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
       "            width=\"100.0\" height=\"100.0\" viewBox=\"-5.00000000000000 -4.00000000000000 12.0000000000000 12.0000000000000\"\n",
       "            preserveAspectRatio=\"xMinYMin meet\">\n",
       "            <defs>\n",
       "                <marker id=\"markerCircle\" markerWidth=\"8\" markerHeight=\"8\"\n",
       "                    refx=\"5\" refy=\"5\" markerUnits=\"strokeWidth\">\n",
       "                    <circle cx=\"5\" cy=\"5\" r=\"1.5\" style=\"stroke: none; fill:#000000;\"/>\n",
       "                </marker>\n",
       "                <marker id=\"markerArrow\" markerWidth=\"13\" markerHeight=\"13\" refx=\"2\" refy=\"4\"\n",
       "                       orient=\"auto\" markerUnits=\"strokeWidth\">\n",
       "                    <path d=\"M2,2 L2,6 L6,4\" style=\"fill: #000000;\" />\n",
       "                </marker>\n",
       "                <marker id=\"markerReverseArrow\" markerWidth=\"13\" markerHeight=\"13\" refx=\"6\" refy=\"4\"\n",
       "                       orient=\"auto\" markerUnits=\"strokeWidth\">\n",
       "                    <path d=\"M6,2 L6,6 L2,4\" style=\"fill: #000000;\" />\n",
       "                </marker>\n",
       "            </defs><g transform=\"matrix(1,0,0,-1,0,4.00000000000000)\"><ellipse fill=\"#66cc99\" stroke=\"#555555\" stroke-width=\"0.240000000000000\" opacity=\"0.6\" cx=\"1.00000000000000\" cy=\"2.00000000000000\" rx=\"5.00000000000000\" ry=\"5.00000000000000\"/></g></svg>"
      ],
      "text/latex": [
       "$\\displaystyle \\operatorname{Circle}\\left(\\operatorname{Point2D}\\left(1, 2\\right), 5\\right)$"
      ],
      "text/plain": [
       "Circle(Point2D(1, 2), 5)"
      ]
     },
     "execution_count": 176,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "id": "6db77bd3",
   "metadata": {},
   "outputs": [],
   "source": [
    "l = Line((2*m+1)*x+y*(m-1)-m+4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "5f8a3f08",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Line2D}\\left(\\operatorname{Point2D}\\left(0, \\frac{m - 4}{m - 1}\\right), \\operatorname{Point2D}\\left(1, \\frac{- 2 m - 1}{m - 1} + \\frac{m - 4}{m - 1}\\right)\\right)$"
      ],
      "text/plain": [
       "Line2D(Point2D(0, (m - 4)/(m - 1)), Point2D(1, (-2*m - 1)/(m - 1) + (m - 4)/(m - 1)))"
      ]
     },
     "execution_count": 178,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "id": "305585f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "A,B=Intersection(c,l)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "id": "4dcc2962",
   "metadata": {},
   "outputs": [],
   "source": [
    "d=A.distance(B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "id": "fa20c6b9",
   "metadata": {},
   "outputs": [],
   "source": [
    "check = simplify(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 182,
   "id": "fabf34ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[4 \\sqrt{5}, 10\\right]$"
      ],
      "text/plain": [
       "Interval(4*sqrt(5), 10)"
      ]
     },
     "execution_count": 182,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_range(factor(check),m,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "id": "64a288e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\frac{1}{4}\\right\\}$"
      ],
      "text/plain": [
       "{1/4}"
      ]
     },
     "execution_count": 183,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(check-4*sqrt(5),m,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "id": "e6fdbc0b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 2 x + y - 5$"
      ],
      "text/plain": [
       "-2*x + y - 5"
      ]
     },
     "execution_count": 186,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l.equation().subs(m,S(1)/4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "324d3490",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.stats import ChiSquared"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "bbe8e4cc",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function ChiSquared in module sympy.stats.crv_types:\n",
      "\n",
      "ChiSquared(name, k)\n",
      "    Create a continuous random variable with a Chi-squared distribution.\n",
      "    \n",
      "    Explanation\n",
      "    ===========\n",
      "    \n",
      "    The density of the Chi-squared distribution is given by\n",
      "    \n",
      "    .. math::\n",
      "        f(x) := \\frac{1}{2^{\\frac{k}{2}}\\Gamma\\left(\\frac{k}{2}\\right)}\n",
      "                x^{\\frac{k}{2}-1} e^{-\\frac{x}{2}}\n",
      "    \n",
      "    with :math:`x \\geq 0`.\n",
      "    \n",
      "    Parameters\n",
      "    ==========\n",
      "    \n",
      "    k : Positive integer\n",
      "        The number of degrees of freedom.\n",
      "    \n",
      "    Returns\n",
      "    =======\n",
      "    \n",
      "    RandomSymbol\n",
      "    \n",
      "    Examples\n",
      "    ========\n",
      "    \n",
      "    >>> from sympy.stats import ChiSquared, density, E, variance, moment\n",
      "    >>> from sympy import Symbol\n",
      "    \n",
      "    >>> k = Symbol(\"k\", integer=True, positive=True)\n",
      "    >>> z = Symbol(\"z\")\n",
      "    \n",
      "    >>> X = ChiSquared(\"x\", k)\n",
      "    \n",
      "    >>> density(X)(z)\n",
      "    z**(k/2 - 1)*exp(-z/2)/(2**(k/2)*gamma(k/2))\n",
      "    \n",
      "    >>> E(X)\n",
      "    k\n",
      "    \n",
      "    >>> variance(X)\n",
      "    2*k\n",
      "    \n",
      "    >>> moment(X, 3)\n",
      "    k**3 + 6*k**2 + 8*k\n",
      "    \n",
      "    References\n",
      "    ==========\n",
      "    \n",
      "    .. [1] https://en.wikipedia.org/wiki/Chi_squared_distribution\n",
      "    .. [2] https://mathworld.wolfram.com/Chi-SquaredDistribution.html\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(ChiSquared)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "36c16310",
   "metadata": {},
   "outputs": [],
   "source": [
    "chi=ChiSquaredTest(Matrix([[35,20],[15,30]]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "7db713be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{100}{11}$"
      ],
      "text/plain": [
       "100/11"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chi.chi_squared_value"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "id": "15918c32",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}35 & 20 & 55\\\\15 & 30 & 45\\\\50 & 50 & 100\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[35, 20,  55],\n",
       "[15, 30,  45],\n",
       "[50, 50, 100]])"
      ]
     },
     "execution_count": 190,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chi.expand_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "b801e34c",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function Hypergeometric in module sympy.stats.frv_types:\n",
      "\n",
      "Hypergeometric(name, N, m, n)\n",
      "    Create a Finite Random Variable representing a hypergeometric distribution.\n",
      "    \n",
      "    Parameters\n",
      "    ==========\n",
      "    \n",
      "    N : Positive Integer\n",
      "      Represents finite population of size N.\n",
      "    m : Positive Integer\n",
      "      Represents number of trials with required feature.\n",
      "    n : Positive Integer\n",
      "      Represents numbers of draws.\n",
      "    \n",
      "    \n",
      "    Examples\n",
      "    ========\n",
      "    \n",
      "    >>> from sympy.stats import Hypergeometric, density\n",
      "    \n",
      "    >>> X = Hypergeometric('X', 10, 5, 3) # 10 marbles, 5 white (success), 3 draws\n",
      "    >>> density(X).dict\n",
      "    {0: 1/12, 1: 5/12, 2: 5/12, 3: 1/12}\n",
      "    \n",
      "    Returns\n",
      "    =======\n",
      "    \n",
      "    RandomSymbol\n",
      "    \n",
      "    References\n",
      "    ==========\n",
      "    \n",
      "    .. [1] https://en.wikipedia.org/wiki/Hypergeometric_distribution\n",
      "    .. [2] https://mathworld.wolfram.com/HypergeometricDistribution.html\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Hypergeometric)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "7dedbd89",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=Hypergeometric(\"X\",5,3,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "69fef744",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1: 3/10, 2: 3/5, 3: 1/10}"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "density(X).dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "id": "1795528a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{9}{5}$"
      ],
      "text/plain": [
       "9/5"
      ]
     },
     "execution_count": 191,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "E(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "a1f683ba",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_dict={sin(t):sqrt(3/S(7)),cos(t):2/sqrt(7)}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "fa263785",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{sin(t): sqrt(21)/7, cos(t): 2*sqrt(7)/7}"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "116ca962",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{2}{13}$"
      ],
      "text/plain": [
       "2/13"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand_trig(cos(2*t)/sin(2*t+pi/6)).subs(data_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "d9b3fec0",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function sequence in module sympy.series.sequences:\n",
      "\n",
      "sequence(seq, limits=None)\n",
      "    Returns appropriate sequence object.\n",
      "    \n",
      "    Explanation\n",
      "    ===========\n",
      "    \n",
      "    If ``seq`` is a SymPy sequence, returns :class:`SeqPer` object\n",
      "    otherwise returns :class:`SeqFormula` object.\n",
      "    \n",
      "    Examples\n",
      "    ========\n",
      "    \n",
      "    >>> from sympy import sequence\n",
      "    >>> from sympy.abc import n\n",
      "    >>> sequence(n**2, (n, 0, 5))\n",
      "    SeqFormula(n**2, (n, 0, 5))\n",
      "    >>> sequence((1, 2, 3), (n, 0, 5))\n",
      "    SeqPer((1, 2, 3), (n, 0, 5))\n",
      "    \n",
      "    See Also\n",
      "    ========\n",
      "    \n",
      "    sympy.series.sequences.SeqPer\n",
      "    sympy.series.sequences.SeqFormula\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(sequence)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "192d31fe",
   "metadata": {},
   "outputs": [],
   "source": [
    "an=sequence(1+S(1)/2*(n-1),(n,1,oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "e21cfd8c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 1$"
      ],
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "an.coeff(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "d8f42313",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=1+S(1)/2*(n-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "id": "c8e7d1ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{n}{2} + \\frac{1}{2}$"
      ],
      "text/plain": [
       "n/2 + 1/2"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "id": "678e7bbe",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class Sum in module sympy.concrete.summations:\n",
      "\n",
      "class Sum(sympy.concrete.expr_with_limits.AddWithLimits, sympy.concrete.expr_with_intlimits.ExprWithIntLimits)\n",
      " |  Sum(function, *symbols, **assumptions)\n",
      " |  \n",
      " |  Represents unevaluated summation.\n",
      " |  \n",
      " |  Explanation\n",
      " |  ===========\n",
      " |  \n",
      " |  ``Sum`` represents a finite or infinite series, with the first argument\n",
      " |  being the general form of terms in the series, and the second argument\n",
      " |  being ``(dummy_variable, start, end)``, with ``dummy_variable`` taking\n",
      " |  all integer values from ``start`` through ``end``. In accordance with\n",
      " |  long-standing mathematical convention, the end term is included in the\n",
      " |  summation.\n",
      " |  \n",
      " |  Finite sums\n",
      " |  ===========\n",
      " |  \n",
      " |  For finite sums (and sums with symbolic limits assumed to be finite) we\n",
      " |  follow the summation convention described by Karr [1], especially\n",
      " |  definition 3 of section 1.4. The sum:\n",
      " |  \n",
      " |  .. math::\n",
      " |  \n",
      " |      \\sum_{m \\leq i < n} f(i)\n",
      " |  \n",
      " |  has *the obvious meaning* for `m < n`, namely:\n",
      " |  \n",
      " |  .. math::\n",
      " |  \n",
      " |      \\sum_{m \\leq i < n} f(i) = f(m) + f(m+1) + \\ldots + f(n-2) + f(n-1)\n",
      " |  \n",
      " |  with the upper limit value `f(n)` excluded. The sum over an empty set is\n",
      " |  zero if and only if `m = n`:\n",
      " |  \n",
      " |  .. math::\n",
      " |  \n",
      " |      \\sum_{m \\leq i < n} f(i) = 0  \\quad \\mathrm{for} \\quad  m = n\n",
      " |  \n",
      " |  Finally, for all other sums over empty sets we assume the following\n",
      " |  definition:\n",
      " |  \n",
      " |  .. math::\n",
      " |  \n",
      " |      \\sum_{m \\leq i < n} f(i) = - \\sum_{n \\leq i < m} f(i)  \\quad \\mathrm{for} \\quad  m > n\n",
      " |  \n",
      " |  It is important to note that Karr defines all sums with the upper\n",
      " |  limit being exclusive. This is in contrast to the usual mathematical notation,\n",
      " |  but does not affect the summation convention. Indeed we have:\n",
      " |  \n",
      " |  .. math::\n",
      " |  \n",
      " |      \\sum_{m \\leq i < n} f(i) = \\sum_{i = m}^{n - 1} f(i)\n",
      " |  \n",
      " |  where the difference in notation is intentional to emphasize the meaning,\n",
      " |  with limits typeset on the top being inclusive.\n",
      " |  \n",
      " |  Examples\n",
      " |  ========\n",
      " |  \n",
      " |  >>> from sympy.abc import i, k, m, n, x\n",
      " |  >>> from sympy import Sum, factorial, oo, IndexedBase, Function\n",
      " |  >>> Sum(k, (k, 1, m))\n",
      " |  Sum(k, (k, 1, m))\n",
      " |  >>> Sum(k, (k, 1, m)).doit()\n",
      " |  m**2/2 + m/2\n",
      " |  >>> Sum(k**2, (k, 1, m))\n",
      " |  Sum(k**2, (k, 1, m))\n",
      " |  >>> Sum(k**2, (k, 1, m)).doit()\n",
      " |  m**3/3 + m**2/2 + m/6\n",
      " |  >>> Sum(x**k, (k, 0, oo))\n",
      " |  Sum(x**k, (k, 0, oo))\n",
      " |  >>> Sum(x**k, (k, 0, oo)).doit()\n",
      " |  Piecewise((1/(1 - x), Abs(x) < 1), (Sum(x**k, (k, 0, oo)), True))\n",
      " |  >>> Sum(x**k/factorial(k), (k, 0, oo)).doit()\n",
      " |  exp(x)\n",
      " |  \n",
      " |  Here are examples to do summation with symbolic indices.  You\n",
      " |  can use either Function of IndexedBase classes:\n",
      " |  \n",
      " |  >>> f = Function('f')\n",
      " |  >>> Sum(f(n), (n, 0, 3)).doit()\n",
      " |  f(0) + f(1) + f(2) + f(3)\n",
      " |  >>> Sum(f(n), (n, 0, oo)).doit()\n",
      " |  Sum(f(n), (n, 0, oo))\n",
      " |  >>> f = IndexedBase('f')\n",
      " |  >>> Sum(f[n]**2, (n, 0, 3)).doit()\n",
      " |  f[0]**2 + f[1]**2 + f[2]**2 + f[3]**2\n",
      " |  \n",
      " |  An example showing that the symbolic result of a summation is still\n",
      " |  valid for seemingly nonsensical values of the limits. Then the Karr\n",
      " |  convention allows us to give a perfectly valid interpretation to\n",
      " |  those sums by interchanging the limits according to the above rules:\n",
      " |  \n",
      " |  >>> S = Sum(i, (i, 1, n)).doit()\n",
      " |  >>> S\n",
      " |  n**2/2 + n/2\n",
      " |  >>> S.subs(n, -4)\n",
      " |  6\n",
      " |  >>> Sum(i, (i, 1, -4)).doit()\n",
      " |  6\n",
      " |  >>> Sum(-i, (i, -3, 0)).doit()\n",
      " |  6\n",
      " |  \n",
      " |  An explicit example of the Karr summation convention:\n",
      " |  \n",
      " |  >>> S1 = Sum(i**2, (i, m, m+n-1)).doit()\n",
      " |  >>> S1\n",
      " |  m**2*n + m*n**2 - m*n + n**3/3 - n**2/2 + n/6\n",
      " |  >>> S2 = Sum(i**2, (i, m+n, m-1)).doit()\n",
      " |  >>> S2\n",
      " |  -m**2*n - m*n**2 + m*n - n**3/3 + n**2/2 - n/6\n",
      " |  >>> S1 + S2\n",
      " |  0\n",
      " |  >>> S3 = Sum(i, (i, m, m-1)).doit()\n",
      " |  >>> S3\n",
      " |  0\n",
      " |  \n",
      " |  See Also\n",
      " |  ========\n",
      " |  \n",
      " |  summation\n",
      " |  Product, sympy.concrete.products.product\n",
      " |  \n",
      " |  References\n",
      " |  ==========\n",
      " |  \n",
      " |  .. [1] Michael Karr, \"Summation in Finite Terms\", Journal of the ACM,\n",
      " |         Volume 28 Issue 2, April 1981, Pages 305-350\n",
      " |         https://dl.acm.org/doi/10.1145/322248.322255\n",
      " |  .. [2] https://en.wikipedia.org/wiki/Summation#Capital-sigma_notation\n",
      " |  .. [3] https://en.wikipedia.org/wiki/Empty_sum\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      Sum\n",
      " |      sympy.concrete.expr_with_limits.AddWithLimits\n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits\n",
      " |      sympy.concrete.expr_with_limits.ExprWithLimits\n",
      " |      sympy.core.expr.Expr\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |  \n",
      " |  euler_maclaurin(self, m=0, n=0, eps=0, eval_integral=True)\n",
      " |      Return an Euler-Maclaurin approximation of self, where m is the\n",
      " |      number of leading terms to sum directly and n is the number of\n",
      " |      terms in the tail.\n",
      " |      \n",
      " |      With m = n = 0, this is simply the corresponding integral\n",
      " |      plus a first-order endpoint correction.\n",
      " |      \n",
      " |      Returns (s, e) where s is the Euler-Maclaurin approximation\n",
      " |      and e is the estimated error (taken to be the magnitude of\n",
      " |      the first omitted term in the tail):\n",
      " |      \n",
      " |          >>> from sympy.abc import k, a, b\n",
      " |          >>> from sympy import Sum\n",
      " |          >>> Sum(1/k, (k, 2, 5)).doit().evalf()\n",
      " |          1.28333333333333\n",
      " |          >>> s, e = Sum(1/k, (k, 2, 5)).euler_maclaurin()\n",
      " |          >>> s\n",
      " |          -log(2) + 7/20 + log(5)\n",
      " |          >>> from sympy import sstr\n",
      " |          >>> print(sstr((s.evalf(), e.evalf()), full_prec=True))\n",
      " |          (1.26629073187415, 0.0175000000000000)\n",
      " |      \n",
      " |      The endpoints may be symbolic:\n",
      " |      \n",
      " |          >>> s, e = Sum(1/k, (k, a, b)).euler_maclaurin()\n",
      " |          >>> s\n",
      " |          -log(a) + log(b) + 1/(2*b) + 1/(2*a)\n",
      " |          >>> e\n",
      " |          Abs(1/(12*b**2) - 1/(12*a**2))\n",
      " |      \n",
      " |      If the function is a polynomial of degree at most 2n+1, the\n",
      " |      Euler-Maclaurin formula becomes exact (and e = 0 is returned):\n",
      " |      \n",
      " |          >>> Sum(k, (k, 2, b)).euler_maclaurin()\n",
      " |          (b**2/2 + b/2 - 1, 0)\n",
      " |          >>> Sum(k, (k, 2, b)).doit()\n",
      " |          b**2/2 + b/2 - 1\n",
      " |      \n",
      " |      With a nonzero eps specified, the summation is ended\n",
      " |      as soon as the remainder term is less than the epsilon.\n",
      " |  \n",
      " |  eval_zeta_function(self, f, limits)\n",
      " |      Check whether the function matches with the zeta function.\n",
      " |      \n",
      " |      If it matches, then return a `Piecewise` expression because\n",
      " |      zeta function does not converge unless `s > 1` and `q > 0`\n",
      " |  \n",
      " |  is_absolutely_convergent(self)\n",
      " |      Checks for the absolute convergence of an infinite series.\n",
      " |      \n",
      " |      Same as checking convergence of absolute value of sequence_term of\n",
      " |      an infinite series.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Absolute_convergence\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Symbol, oo\n",
      " |      >>> n = Symbol('n', integer=True)\n",
      " |      >>> Sum((-1)**n, (n, 1, oo)).is_absolutely_convergent()\n",
      " |      False\n",
      " |      >>> Sum((-1)**n/n**2, (n, 1, oo)).is_absolutely_convergent()\n",
      " |      True\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      Sum.is_convergent\n",
      " |  \n",
      " |  is_convergent(self)\n",
      " |      Checks for the convergence of a Sum.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      We divide the study of convergence of infinite sums and products in\n",
      " |      two parts.\n",
      " |      \n",
      " |      First Part:\n",
      " |      One part is the question whether all the terms are well defined, i.e.,\n",
      " |      they are finite in a sum and also non-zero in a product. Zero\n",
      " |      is the analogy of (minus) infinity in products as\n",
      " |      :math:`e^{-\\infty} = 0`.\n",
      " |      \n",
      " |      Second Part:\n",
      " |      The second part is the question of convergence after infinities,\n",
      " |      and zeros in products, have been omitted assuming that their number\n",
      " |      is finite. This means that we only consider the tail of the sum or\n",
      " |      product, starting from some point after which all terms are well\n",
      " |      defined.\n",
      " |      \n",
      " |      For example, in a sum of the form:\n",
      " |      \n",
      " |      .. math::\n",
      " |      \n",
      " |          \\sum_{1 \\leq i < \\infty} \\frac{1}{n^2 + an + b}\n",
      " |      \n",
      " |      where a and b are numbers. The routine will return true, even if there\n",
      " |      are infinities in the term sequence (at most two). An analogous\n",
      " |      product would be:\n",
      " |      \n",
      " |      .. math::\n",
      " |      \n",
      " |          \\prod_{1 \\leq i < \\infty} e^{\\frac{1}{n^2 + an + b}}\n",
      " |      \n",
      " |      This is how convergence is interpreted. It is concerned with what\n",
      " |      happens at the limit. Finding the bad terms is another independent\n",
      " |      matter.\n",
      " |      \n",
      " |      Note: It is responsibility of user to see that the sum or product\n",
      " |      is well defined.\n",
      " |      \n",
      " |      There are various tests employed to check the convergence like\n",
      " |      divergence test, root test, integral test, alternating series test,\n",
      " |      comparison tests, Dirichlet tests. It returns true if Sum is convergent\n",
      " |      and false if divergent and NotImplementedError if it cannot be checked.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Convergence_tests\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import factorial, S, Sum, Symbol, oo\n",
      " |      >>> n = Symbol('n', integer=True)\n",
      " |      >>> Sum(n/(n - 1), (n, 4, 7)).is_convergent()\n",
      " |      True\n",
      " |      >>> Sum(n/(2*n + 1), (n, 1, oo)).is_convergent()\n",
      " |      False\n",
      " |      >>> Sum(factorial(n)/5**n, (n, 1, oo)).is_convergent()\n",
      " |      False\n",
      " |      >>> Sum(1/n**(S(6)/5), (n, 1, oo)).is_convergent()\n",
      " |      True\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      Sum.is_absolutely_convergent\n",
      " |      sympy.concrete.products.Product.is_convergent\n",
      " |  \n",
      " |  reverse_order(self, *indices)\n",
      " |      Reverse the order of a limit in a Sum.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      ``reverse_order(self, *indices)`` reverses some limits in the expression\n",
      " |      ``self`` which can be either a ``Sum`` or a ``Product``. The selectors in\n",
      " |      the argument ``indices`` specify some indices whose limits get reversed.\n",
      " |      These selectors are either variable names or numerical indices counted\n",
      " |      starting from the inner-most limit tuple.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum\n",
      " |      >>> from sympy.abc import x, y, a, b, c, d\n",
      " |      \n",
      " |      >>> Sum(x, (x, 0, 3)).reverse_order(x)\n",
      " |      Sum(-x, (x, 4, -1))\n",
      " |      >>> Sum(x*y, (x, 1, 5), (y, 0, 6)).reverse_order(x, y)\n",
      " |      Sum(x*y, (x, 6, 0), (y, 7, -1))\n",
      " |      >>> Sum(x, (x, a, b)).reverse_order(x)\n",
      " |      Sum(-x, (x, b + 1, a - 1))\n",
      " |      >>> Sum(x, (x, a, b)).reverse_order(0)\n",
      " |      Sum(-x, (x, b + 1, a - 1))\n",
      " |      \n",
      " |      While one should prefer variable names when specifying which limits\n",
      " |      to reverse, the index counting notation comes in handy in case there\n",
      " |      are several symbols with the same name.\n",
      " |      \n",
      " |      >>> S = Sum(x**2, (x, a, b), (x, c, d))\n",
      " |      >>> S\n",
      " |      Sum(x**2, (x, a, b), (x, c, d))\n",
      " |      >>> S0 = S.reverse_order(0)\n",
      " |      >>> S0\n",
      " |      Sum(-x**2, (x, b + 1, a - 1), (x, c, d))\n",
      " |      >>> S1 = S0.reverse_order(1)\n",
      " |      >>> S1\n",
      " |      Sum(x**2, (x, b + 1, a - 1), (x, d + 1, c - 1))\n",
      " |      \n",
      " |      Of course we can mix both notations:\n",
      " |      \n",
      " |      >>> Sum(x*y, (x, a, b), (y, 2, 5)).reverse_order(x, 1)\n",
      " |      Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))\n",
      " |      >>> Sum(x*y, (x, a, b), (y, 2, 5)).reverse_order(y, x)\n",
      " |      Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits.index, reorder_limit,\n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits.reorder\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] Michael Karr, \"Summation in Finite Terms\", Journal of the ACM,\n",
      " |             Volume 28 Issue 2, April 1981, Pages 305-350\n",
      " |             https://dl.acm.org/doi/10.1145/322248.322255\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(cls, function, *symbols, **assumptions)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  __annotations__ = {'limits': typing.Tuple[typing.Tuple[sympy.core.symb...\n",
      " |  \n",
      " |  default_assumptions = {}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.concrete.expr_with_intlimits.ExprWithIntLimits:\n",
      " |  \n",
      " |  change_index(self, var, trafo, newvar=None)\n",
      " |      Change index of a Sum or Product.\n",
      " |      \n",
      " |      Perform a linear transformation `x \\mapsto a x + b` on the index variable\n",
      " |      `x`. For `a` the only values allowed are `\\pm 1`. A new variable to be used\n",
      " |      after the change of index can also be specified.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      ``change_index(expr, var, trafo, newvar=None)`` where ``var`` specifies the\n",
      " |      index variable `x` to transform. The transformation ``trafo`` must be linear\n",
      " |      and given in terms of ``var``. If the optional argument ``newvar`` is\n",
      " |      provided then ``var`` gets replaced by ``newvar`` in the final expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Product, simplify\n",
      " |      >>> from sympy.abc import x, y, a, b, c, d, u, v, i, j, k, l\n",
      " |      \n",
      " |      >>> S = Sum(x, (x, a, b))\n",
      " |      >>> S.doit()\n",
      " |      -a**2/2 + a/2 + b**2/2 + b/2\n",
      " |      \n",
      " |      >>> Sn = S.change_index(x, x + 1, y)\n",
      " |      >>> Sn\n",
      " |      Sum(y - 1, (y, a + 1, b + 1))\n",
      " |      >>> Sn.doit()\n",
      " |      -a**2/2 + a/2 + b**2/2 + b/2\n",
      " |      \n",
      " |      >>> Sn = S.change_index(x, -x, y)\n",
      " |      >>> Sn\n",
      " |      Sum(-y, (y, -b, -a))\n",
      " |      >>> Sn.doit()\n",
      " |      -a**2/2 + a/2 + b**2/2 + b/2\n",
      " |      \n",
      " |      >>> Sn = S.change_index(x, x+u)\n",
      " |      >>> Sn\n",
      " |      Sum(-u + x, (x, a + u, b + u))\n",
      " |      >>> Sn.doit()\n",
      " |      -a**2/2 - a*u + a/2 + b**2/2 + b*u + b/2 - u*(-a + b + 1) + u\n",
      " |      >>> simplify(Sn.doit())\n",
      " |      -a**2/2 + a/2 + b**2/2 + b/2\n",
      " |      \n",
      " |      >>> Sn = S.change_index(x, -x - u, y)\n",
      " |      >>> Sn\n",
      " |      Sum(-u - y, (y, -b - u, -a - u))\n",
      " |      >>> Sn.doit()\n",
      " |      -a**2/2 - a*u + a/2 + b**2/2 + b*u + b/2 - u*(-a + b + 1) + u\n",
      " |      >>> simplify(Sn.doit())\n",
      " |      -a**2/2 + a/2 + b**2/2 + b/2\n",
      " |      \n",
      " |      >>> P = Product(i*j**2, (i, a, b), (j, c, d))\n",
      " |      >>> P\n",
      " |      Product(i*j**2, (i, a, b), (j, c, d))\n",
      " |      >>> P2 = P.change_index(i, i+3, k)\n",
      " |      >>> P2\n",
      " |      Product(j**2*(k - 3), (k, a + 3, b + 3), (j, c, d))\n",
      " |      >>> P3 = P2.change_index(j, -j, l)\n",
      " |      >>> P3\n",
      " |      Product(l**2*(k - 3), (k, a + 3, b + 3), (l, -d, -c))\n",
      " |      \n",
      " |      When dealing with symbols only, we can make a\n",
      " |      general linear transformation:\n",
      " |      \n",
      " |      >>> Sn = S.change_index(x, u*x+v, y)\n",
      " |      >>> Sn\n",
      " |      Sum((-v + y)/u, (y, b*u + v, a*u + v))\n",
      " |      >>> Sn.doit()\n",
      " |      -v*(a*u - b*u + 1)/u + (a**2*u**2/2 + a*u*v + a*u/2 - b**2*u**2/2 - b*u*v + b*u/2 + v)/u\n",
      " |      >>> simplify(Sn.doit())\n",
      " |      a**2*u/2 + a/2 - b**2*u/2 + b/2\n",
      " |      \n",
      " |      However, the last result can be inconsistent with usual\n",
      " |      summation where the index increment is always 1. This is\n",
      " |      obvious as we get back the original value only for ``u``\n",
      " |      equal +1 or -1.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits.index,\n",
      " |      reorder_limit,\n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits.reorder,\n",
      " |      sympy.concrete.summations.Sum.reverse_order,\n",
      " |      sympy.concrete.products.Product.reverse_order\n",
      " |  \n",
      " |  index(expr, x)\n",
      " |      Return the index of a dummy variable in the list of limits.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      ``index(expr, x)``  returns the index of the dummy variable ``x`` in the\n",
      " |      limits of ``expr``. Note that we start counting with 0 at the inner-most\n",
      " |      limits tuple.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, a, b, c, d\n",
      " |      >>> from sympy import Sum, Product\n",
      " |      >>> Sum(x*y, (x, a, b), (y, c, d)).index(x)\n",
      " |      0\n",
      " |      >>> Sum(x*y, (x, a, b), (y, c, d)).index(y)\n",
      " |      1\n",
      " |      >>> Product(x*y, (x, a, b), (y, c, d)).index(x)\n",
      " |      0\n",
      " |      >>> Product(x*y, (x, a, b), (y, c, d)).index(y)\n",
      " |      1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      reorder_limit, reorder, sympy.concrete.summations.Sum.reverse_order,\n",
      " |      sympy.concrete.products.Product.reverse_order\n",
      " |  \n",
      " |  reorder(expr, *arg)\n",
      " |      Reorder limits in a expression containing a Sum or a Product.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      ``expr.reorder(*arg)`` reorders the limits in the expression ``expr``\n",
      " |      according to the list of tuples given by ``arg``. These tuples can\n",
      " |      contain numerical indices or index variable names or involve both.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Product\n",
      " |      >>> from sympy.abc import x, y, z, a, b, c, d, e, f\n",
      " |      \n",
      " |      >>> Sum(x*y, (x, a, b), (y, c, d)).reorder((x, y))\n",
      " |      Sum(x*y, (y, c, d), (x, a, b))\n",
      " |      \n",
      " |      >>> Sum(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder((x, y), (x, z), (y, z))\n",
      " |      Sum(x*y*z, (z, e, f), (y, c, d), (x, a, b))\n",
      " |      \n",
      " |      >>> P = Product(x*y*z, (x, a, b), (y, c, d), (z, e, f))\n",
      " |      >>> P.reorder((x, y), (x, z), (y, z))\n",
      " |      Product(x*y*z, (z, e, f), (y, c, d), (x, a, b))\n",
      " |      \n",
      " |      We can also select the index variables by counting them, starting\n",
      " |      with the inner-most one:\n",
      " |      \n",
      " |      >>> Sum(x**2, (x, a, b), (x, c, d)).reorder((0, 1))\n",
      " |      Sum(x**2, (x, c, d), (x, a, b))\n",
      " |      \n",
      " |      And of course we can mix both schemes:\n",
      " |      \n",
      " |      >>> Sum(x*y, (x, a, b), (y, c, d)).reorder((y, x))\n",
      " |      Sum(x*y, (y, c, d), (x, a, b))\n",
      " |      >>> Sum(x*y, (x, a, b), (y, c, d)).reorder((y, 0))\n",
      " |      Sum(x*y, (y, c, d), (x, a, b))\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      reorder_limit, index, sympy.concrete.summations.Sum.reverse_order,\n",
      " |      sympy.concrete.products.Product.reverse_order\n",
      " |  \n",
      " |  reorder_limit(expr, x, y)\n",
      " |      Interchange two limit tuples of a Sum or Product expression.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      ``expr.reorder_limit(x, y)`` interchanges two limit tuples. The\n",
      " |      arguments ``x`` and ``y`` are integers corresponding to the index\n",
      " |      variables of the two limits which are to be interchanged. The\n",
      " |      expression ``expr`` has to be either a Sum or a Product.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z, a, b, c, d, e, f\n",
      " |      >>> from sympy import Sum, Product\n",
      " |      \n",
      " |      >>> Sum(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder_limit(0, 2)\n",
      " |      Sum(x*y*z, (z, e, f), (y, c, d), (x, a, b))\n",
      " |      >>> Sum(x**2, (x, a, b), (x, c, d)).reorder_limit(1, 0)\n",
      " |      Sum(x**2, (x, c, d), (x, a, b))\n",
      " |      \n",
      " |      >>> Product(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder_limit(0, 2)\n",
      " |      Product(x*y*z, (z, e, f), (y, c, d), (x, a, b))\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      index, reorder, sympy.concrete.summations.Sum.reverse_order,\n",
      " |      sympy.concrete.products.Product.reverse_order\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.concrete.expr_with_intlimits.ExprWithIntLimits:\n",
      " |  \n",
      " |  has_empty_sequence\n",
      " |      Returns True if the Sum or Product is computed for an empty sequence.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Product, Symbol\n",
      " |      >>> m = Symbol('m')\n",
      " |      >>> Sum(m, (m, 1, 0)).has_empty_sequence\n",
      " |      True\n",
      " |      \n",
      " |      >>> Sum(m, (m, 1, 1)).has_empty_sequence\n",
      " |      False\n",
      " |      \n",
      " |      >>> M = Symbol('M', integer=True, positive=True)\n",
      " |      >>> Product(m, (m, 1, M)).has_empty_sequence\n",
      " |      False\n",
      " |      \n",
      " |      >>> Product(m, (m, 2, M)).has_empty_sequence\n",
      " |      \n",
      " |      >>> Product(m, (m, M + 1, M)).has_empty_sequence\n",
      " |      True\n",
      " |      \n",
      " |      >>> N = Symbol('N', integer=True, positive=True)\n",
      " |      >>> Sum(m, (m, N, M)).has_empty_sequence\n",
      " |      \n",
      " |      >>> N = Symbol('N', integer=True, negative=True)\n",
      " |      >>> Sum(m, (m, N, M)).has_empty_sequence\n",
      " |      False\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      has_reversed_limits\n",
      " |      has_finite_limits\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.concrete.expr_with_limits.ExprWithLimits:\n",
      " |  \n",
      " |  bound_symbols\n",
      " |      Return only variables that are dummy variables.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x, i, j, k\n",
      " |      >>> Integral(x**i, (i, 1, 3), (j, 2), k).bound_symbols\n",
      " |      [i, j]\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      function, limits, free_symbols\n",
      " |      as_dummy : Rename dummy variables\n",
      " |      sympy.integrals.integrals.Integral.transform : Perform mapping on the dummy variable\n",
      " |  \n",
      " |  free_symbols\n",
      " |      This method returns the symbols in the object, excluding those\n",
      " |      that take on a specific value (i.e. the dummy symbols).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> Sum(x, (x, y, 1)).free_symbols\n",
      " |      {y}\n",
      " |  \n",
      " |  function\n",
      " |      Return the function applied across limits.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Integral(x**2, (x,)).function\n",
      " |      x**2\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      limits, variables, free_symbols\n",
      " |  \n",
      " |  has_finite_limits\n",
      " |      Returns True if the limits are known to be finite, either by the\n",
      " |      explicit bounds, assumptions on the bounds, or assumptions on the\n",
      " |      variables.  False if known to be infinite, based on the bounds.\n",
      " |      None if not enough information is available to determine.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Integral, Product, oo, Symbol\n",
      " |      >>> x = Symbol('x')\n",
      " |      >>> Sum(x, (x, 1, 8)).has_finite_limits\n",
      " |      True\n",
      " |      \n",
      " |      >>> Integral(x, (x, 1, oo)).has_finite_limits\n",
      " |      False\n",
      " |      \n",
      " |      >>> M = Symbol('M')\n",
      " |      >>> Sum(x, (x, 1, M)).has_finite_limits\n",
      " |      \n",
      " |      >>> N = Symbol('N', integer=True)\n",
      " |      >>> Product(x, (x, 1, N)).has_finite_limits\n",
      " |      True\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      has_reversed_limits\n",
      " |  \n",
      " |  has_reversed_limits\n",
      " |      Returns True if the limits are known to be in reversed order, either\n",
      " |      by the explicit bounds, assumptions on the bounds, or assumptions on the\n",
      " |      variables.  False if known to be in normal order, based on the bounds.\n",
      " |      None if not enough information is available to determine.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Sum, Integral, Product, oo, Symbol\n",
      " |      >>> x = Symbol('x')\n",
      " |      >>> Sum(x, (x, 8, 1)).has_reversed_limits\n",
      " |      True\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, oo)).has_reversed_limits\n",
      " |      False\n",
      " |      \n",
      " |      >>> M = Symbol('M')\n",
      " |      >>> Integral(x, (x, 1, M)).has_reversed_limits\n",
      " |      \n",
      " |      >>> N = Symbol('N', integer=True, positive=True)\n",
      " |      >>> Sum(x, (x, 1, N)).has_reversed_limits\n",
      " |      False\n",
      " |      \n",
      " |      >>> Product(x, (x, 2, N)).has_reversed_limits\n",
      " |      \n",
      " |      >>> Product(x, (x, 2, N)).subs(N, N + 2).has_reversed_limits\n",
      " |      False\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.concrete.expr_with_intlimits.ExprWithIntLimits.has_empty_sequence\n",
      " |  \n",
      " |  is_number\n",
      " |      Return True if the Sum has no free symbols, else False.\n",
      " |  \n",
      " |  kind\n",
      " |  \n",
      " |  limits\n",
      " |      Return the limits of expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x, i\n",
      " |      >>> Integral(x**i, (i, 1, 3)).limits\n",
      " |      ((i, 1, 3),)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      function, variables, free_symbols\n",
      " |  \n",
      " |  variables\n",
      " |      Return a list of the limit variables.\n",
      " |      \n",
      " |      >>> from sympy import Sum\n",
      " |      >>> from sympy.abc import x, i\n",
      " |      >>> Sum(x**i, (i, 1, 3)).variables\n",
      " |      [i]\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      function, limits, free_symbols\n",
      " |      as_dummy : Rename dummy variables\n",
      " |      sympy.integrals.integrals.Integral.transform : Perform mapping on the dummy variable\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from sympy.concrete.expr_with_limits.ExprWithLimits:\n",
      " |  \n",
      " |  is_commutative\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  __abs__(self) -> 'Expr'\n",
      " |  \n",
      " |  __add__(self, other)\n",
      " |  \n",
      " |  __complex__(self)\n",
      " |  \n",
      " |  __divmod__(self, other)\n",
      " |  \n",
      " |  __float__(self)\n",
      " |  \n",
      " |  __floordiv__(self, other)\n",
      " |  \n",
      " |  __format__(self, format_spec: 'str')\n",
      " |      Default object formatter.\n",
      " |  \n",
      " |  __ge__(self, other)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __gt__(self, other)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __int__(self)\n",
      " |  \n",
      " |  __le__(self, other)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __lt__(self, other)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __mod__(self, other)\n",
      " |  \n",
      " |  __mul__(self, other)\n",
      " |  \n",
      " |  __neg__(self)\n",
      " |  \n",
      " |  __pos__(self)\n",
      " |  \n",
      " |  __pow__(self, other, mod=None) -> 'Expr'\n",
      " |  \n",
      " |  __radd__(self, other)\n",
      " |  \n",
      " |  __rdivmod__(self, other)\n",
      " |  \n",
      " |  __rfloordiv__(self, other)\n",
      " |  \n",
      " |  __rmod__(self, other)\n",
      " |  \n",
      " |  __rmul__(self, other)\n",
      " |  \n",
      " |  __round__ = round(self, n=None)\n",
      " |  \n",
      " |  __rpow__(self, other)\n",
      " |  \n",
      " |  __rsub__(self, other)\n",
      " |  \n",
      " |  __rtruediv__(self, other)\n",
      " |  \n",
      " |  __sub__(self, other)\n",
      " |  \n",
      " |  __truediv__(self, other)\n",
      " |  \n",
      " |  __trunc__(self)\n",
      " |  \n",
      " |  adjoint(self)\n",
      " |  \n",
      " |  apart(self, x=None, **args)\n",
      " |      See the apart function in sympy.polys\n",
      " |  \n",
      " |  args_cnc(self, cset=False, warn=True, split_1=True)\n",
      " |      Return [commutative factors, non-commutative factors] of self.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      self is treated as a Mul and the ordering of the factors is maintained.\n",
      " |      If ``cset`` is True the commutative factors will be returned in a set.\n",
      " |      If there were repeated factors (as may happen with an unevaluated Mul)\n",
      " |      then an error will be raised unless it is explicitly suppressed by\n",
      " |      setting ``warn`` to False.\n",
      " |      \n",
      " |      Note: -1 is always separated from a Number unless split_1 is False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, oo\n",
      " |      >>> A, B = symbols('A B', commutative=0)\n",
      " |      >>> x, y = symbols('x y')\n",
      " |      >>> (-2*x*y).args_cnc()\n",
      " |      [[-1, 2, x, y], []]\n",
      " |      >>> (-2.5*x).args_cnc()\n",
      " |      [[-1, 2.5, x], []]\n",
      " |      >>> (-2*x*A*B*y).args_cnc()\n",
      " |      [[-1, 2, x, y], [A, B]]\n",
      " |      >>> (-2*x*A*B*y).args_cnc(split_1=False)\n",
      " |      [[-2, x, y], [A, B]]\n",
      " |      >>> (-2*x*y).args_cnc(cset=True)\n",
      " |      [{-1, 2, x, y}, []]\n",
      " |      \n",
      " |      The arg is always treated as a Mul:\n",
      " |      \n",
      " |      >>> (-2 + x + A).args_cnc()\n",
      " |      [[], [x - 2 + A]]\n",
      " |      >>> (-oo).args_cnc() # -oo is a singleton\n",
      " |      [[-1, oo], []]\n",
      " |  \n",
      " |  as_base_exp(self) -> 'tuple[Expr, Expr]'\n",
      " |  \n",
      " |  as_coeff_Add(self, rational=False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a summation.\n",
      " |  \n",
      " |  as_coeff_Mul(self, rational: 'bool' = False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a product.\n",
      " |  \n",
      " |  as_coeff_add(self, *deps) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as an Add, ``a``.\n",
      " |      \n",
      " |      c should be a Rational added to any terms of the Add that are\n",
      " |      independent of deps.\n",
      " |      \n",
      " |      args should be a tuple of all other terms of ``a``; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |      \n",
      " |      This should be used when you do not know if self is an Add or not but\n",
      " |      you want to treat self as an Add or if you want to process the\n",
      " |      individual arguments of the tail of self as an Add.\n",
      " |      \n",
      " |      - if you know self is an Add and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail.\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_add()\n",
      " |      (3, ())\n",
      " |      >>> (3 + x).as_coeff_add()\n",
      " |      (3, (x,))\n",
      " |      >>> (3 + x + y).as_coeff_add(x)\n",
      " |      (y + 3, (x,))\n",
      " |      >>> (3 + y).as_coeff_add(x)\n",
      " |      (y + 3, ())\n",
      " |  \n",
      " |  as_coeff_exponent(self, x) -> 'tuple[Expr, Expr]'\n",
      " |      ``c*x**e -> c,e`` where x can be any symbolic expression.\n",
      " |  \n",
      " |  as_coeff_mul(self, *deps, **kwargs) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as a Mul, ``m``.\n",
      " |      \n",
      " |      c should be a Rational multiplied by any factors of the Mul that are\n",
      " |      independent of deps.\n",
      " |      \n",
      " |      args should be a tuple of all other factors of m; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |      \n",
      " |      This should be used when you do not know if self is a Mul or not but\n",
      " |      you want to treat self as a Mul or if you want to process the\n",
      " |      individual arguments of the tail of self as a Mul.\n",
      " |      \n",
      " |      - if you know self is a Mul and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail;\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_mul()\n",
      " |      (3, ())\n",
      " |      >>> (3*x*y).as_coeff_mul()\n",
      " |      (3, (x, y))\n",
      " |      >>> (3*x*y).as_coeff_mul(x)\n",
      " |      (3*y, (x,))\n",
      " |      >>> (3*y).as_coeff_mul(x)\n",
      " |      (3*y, ())\n",
      " |  \n",
      " |  as_coefficient(self, expr)\n",
      " |      Extracts symbolic coefficient at the given expression. In\n",
      " |      other words, this functions separates 'self' into the product\n",
      " |      of 'expr' and 'expr'-free coefficient. If such separation\n",
      " |      is not possible it will return None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import E, pi, sin, I, Poly\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> E.as_coefficient(E)\n",
      " |      1\n",
      " |      >>> (2*E).as_coefficient(E)\n",
      " |      2\n",
      " |      >>> (2*sin(E)*E).as_coefficient(E)\n",
      " |      \n",
      " |      Two terms have E in them so a sum is returned. (If one were\n",
      " |      desiring the coefficient of the term exactly matching E then\n",
      " |      the constant from the returned expression could be selected.\n",
      " |      Or, for greater precision, a method of Poly can be used to\n",
      " |      indicate the desired term from which the coefficient is\n",
      " |      desired.)\n",
      " |      \n",
      " |      >>> (2*E + x*E).as_coefficient(E)\n",
      " |      x + 2\n",
      " |      >>> _.args[0]  # just want the exact match\n",
      " |      2\n",
      " |      >>> p = Poly(2*E + x*E); p\n",
      " |      Poly(x*E + 2*E, x, E, domain='ZZ')\n",
      " |      >>> p.coeff_monomial(E)\n",
      " |      2\n",
      " |      >>> p.nth(0, 1)\n",
      " |      2\n",
      " |      \n",
      " |      Since the following cannot be written as a product containing\n",
      " |      E as a factor, None is returned. (If the coefficient ``2*x`` is\n",
      " |      desired then the ``coeff`` method should be used.)\n",
      " |      \n",
      " |      >>> (2*E*x + x).as_coefficient(E)\n",
      " |      >>> (2*E*x + x).coeff(E)\n",
      " |      2*x\n",
      " |      \n",
      " |      >>> (E*(x + 1) + x).as_coefficient(E)\n",
      " |      \n",
      " |      >>> (2*pi*I).as_coefficient(pi*I)\n",
      " |      2\n",
      " |      >>> (2*I).as_coefficient(pi*I)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      coeff: return sum of terms have a given factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |  \n",
      " |  as_coefficients_dict(self, *syms)\n",
      " |      Return a dictionary mapping terms to their Rational coefficient.\n",
      " |      Since the dictionary is a defaultdict, inquiries about terms which\n",
      " |      were not present will return a coefficient of 0.\n",
      " |      \n",
      " |      If symbols ``syms`` are provided, any multiplicative terms\n",
      " |      independent of them will be considered a coefficient and a\n",
      " |      regular dictionary of syms-dependent generators as keys and\n",
      " |      their corresponding coefficients as values will be returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import a, x, y\n",
      " |      >>> (3*x + a*x + 4).as_coefficients_dict()\n",
      " |      {1: 4, x: 3, a*x: 1}\n",
      " |      >>> _[a]\n",
      " |      0\n",
      " |      >>> (3*a*x).as_coefficients_dict()\n",
      " |      {a*x: 3}\n",
      " |      >>> (3*a*x).as_coefficients_dict(x)\n",
      " |      {x: 3*a}\n",
      " |      >>> (3*a*x).as_coefficients_dict(y)\n",
      " |      {1: 3*a*x}\n",
      " |  \n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      This method should recursively remove a Rational from all arguments\n",
      " |      and return that (content) and the new self (primitive). The content\n",
      " |      should always be positive and ``Mul(*foo.as_content_primitive()) == foo``.\n",
      " |      The primitive need not be in canonical form and should try to preserve\n",
      " |      the underlying structure if possible (i.e. expand_mul should not be\n",
      " |      applied to self).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      >>> eq = 2 + 2*x + 2*y*(3 + 3*y)\n",
      " |      \n",
      " |      The as_content_primitive function is recursive and retains structure:\n",
      " |      \n",
      " |      >>> eq.as_content_primitive()\n",
      " |      (2, x + 3*y*(y + 1) + 1)\n",
      " |      \n",
      " |      Integer powers will have Rationals extracted from the base:\n",
      " |      \n",
      " |      >>> ((2 + 6*x)**2).as_content_primitive()\n",
      " |      (4, (3*x + 1)**2)\n",
      " |      >>> ((2 + 6*x)**(2*y)).as_content_primitive()\n",
      " |      (1, (2*(3*x + 1))**(2*y))\n",
      " |      \n",
      " |      Terms may end up joining once their as_content_primitives are added:\n",
      " |      \n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (11, x*(y + 1))\n",
      " |      >>> ((3*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (9, x*(y + 1))\n",
      " |      >>> ((3*(z*(1 + y)) + 2.0*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (1, 6.0*x*(y + 1) + 3*z*(y + 1))\n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (121, x**2*(y + 1)**2)\n",
      " |      >>> ((x*(1 + y) + 0.4*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (1, 4.84*x**2*(y + 1)**2)\n",
      " |      \n",
      " |      Radical content can also be factored out of the primitive:\n",
      " |      \n",
      " |      >>> (2*sqrt(2) + 4*sqrt(10)).as_content_primitive(radical=True)\n",
      " |      (2, sqrt(2)*(1 + 2*sqrt(5)))\n",
      " |      \n",
      " |      If clear=False (default is True) then content will not be removed\n",
      " |      from an Add if it can be distributed to leave one or more\n",
      " |      terms with integer coefficients.\n",
      " |      \n",
      " |      >>> (x/2 + y).as_content_primitive()\n",
      " |      (1/2, x + 2*y)\n",
      " |      >>> (x/2 + y).as_content_primitive(clear=False)\n",
      " |      (1, x/2 + y)\n",
      " |  \n",
      " |  as_expr(self, *gens)\n",
      " |      Convert a polynomial to a SymPy expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> f = (x**2 + x*y).as_poly(x, y)\n",
      " |      >>> f.as_expr()\n",
      " |      x**2 + x*y\n",
      " |      \n",
      " |      >>> sin(x).as_expr()\n",
      " |      sin(x)\n",
      " |  \n",
      " |  as_independent(self, *deps, **hint) -> 'tuple[Expr, Expr]'\n",
      " |      A mostly naive separation of a Mul or Add into arguments that are not\n",
      " |      are dependent on deps. To obtain as complete a separation of variables\n",
      " |      as possible, use a separation method first, e.g.:\n",
      " |      \n",
      " |      * separatevars() to change Mul, Add and Pow (including exp) into Mul\n",
      " |      * .expand(mul=True) to change Add or Mul into Add\n",
      " |      * .expand(log=True) to change log expr into an Add\n",
      " |      \n",
      " |      The only non-naive thing that is done here is to respect noncommutative\n",
      " |      ordering of variables and to always return (0, 0) for `self` of zero\n",
      " |      regardless of hints.\n",
      " |      \n",
      " |      For nonzero `self`, the returned tuple (i, d) has the\n",
      " |      following interpretation:\n",
      " |      \n",
      " |      * i will has no variable that appears in deps\n",
      " |      * d will either have terms that contain variables that are in deps, or\n",
      " |        be equal to 0 (when self is an Add) or 1 (when self is a Mul)\n",
      " |      * if self is an Add then self = i + d\n",
      " |      * if self is a Mul then self = i*d\n",
      " |      * otherwise (self, S.One) or (S.One, self) is returned.\n",
      " |      \n",
      " |      To force the expression to be treated as an Add, use the hint as_Add=True\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      -- self is an Add\n",
      " |      \n",
      " |      >>> from sympy import sin, cos, exp\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      >>> (x + x*y).as_independent(x)\n",
      " |      (0, x*y + x)\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x)\n",
      " |      (y + z, 2*x*sin(x) + x)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x, y)\n",
      " |      (z, 2*x*sin(x) + x + y)\n",
      " |      \n",
      " |      -- self is a Mul\n",
      " |      \n",
      " |      >>> (x*sin(x)*cos(y)).as_independent(x)\n",
      " |      (cos(y), x*sin(x))\n",
      " |      \n",
      " |      non-commutative terms cannot always be separated out when self is a Mul\n",
      " |      \n",
      " |      >>> from sympy import symbols\n",
      " |      >>> n1, n2, n3 = symbols('n1 n2 n3', commutative=False)\n",
      " |      >>> (n1 + n1*n2).as_independent(n2)\n",
      " |      (n1, n1*n2)\n",
      " |      >>> (n2*n1 + n1*n2).as_independent(n2)\n",
      " |      (0, n1*n2 + n2*n1)\n",
      " |      >>> (n1*n2*n3).as_independent(n1)\n",
      " |      (1, n1*n2*n3)\n",
      " |      >>> (n1*n2*n3).as_independent(n2)\n",
      " |      (n1, n2*n3)\n",
      " |      >>> ((x-n1)*(x-y)).as_independent(x)\n",
      " |      (1, (x - y)*(x - n1))\n",
      " |      \n",
      " |      -- self is anything else:\n",
      " |      \n",
      " |      >>> (sin(x)).as_independent(x)\n",
      " |      (1, sin(x))\n",
      " |      >>> (sin(x)).as_independent(y)\n",
      " |      (sin(x), 1)\n",
      " |      >>> exp(x+y).as_independent(x)\n",
      " |      (1, exp(x + y))\n",
      " |      \n",
      " |      -- force self to be treated as an Add:\n",
      " |      \n",
      " |      >>> (3*x).as_independent(x, as_Add=True)\n",
      " |      (0, 3*x)\n",
      " |      \n",
      " |      -- force self to be treated as a Mul:\n",
      " |      \n",
      " |      >>> (3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x + 3)\n",
      " |      >>> (-3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x - 3)\n",
      " |      \n",
      " |      Note how the below differs from the above in making the\n",
      " |      constant on the dep term positive.\n",
      " |      \n",
      " |      >>> (y*(-3+x)).as_independent(x)\n",
      " |      (y, x - 3)\n",
      " |      \n",
      " |      -- use .as_independent() for true independence testing instead\n",
      " |         of .has(). The former considers only symbols in the free\n",
      " |         symbols while the latter considers all symbols\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> I = Integral(x, (x, 1, 2))\n",
      " |      >>> I.has(x)\n",
      " |      True\n",
      " |      >>> x in I.free_symbols\n",
      " |      False\n",
      " |      >>> I.as_independent(x) == (I, 1)\n",
      " |      True\n",
      " |      >>> (I + x).as_independent(x) == (I, x)\n",
      " |      True\n",
      " |      \n",
      " |      Note: when trying to get independent terms, a separation method\n",
      " |      might need to be used first. In this case, it is important to keep\n",
      " |      track of what you send to this routine so you know how to interpret\n",
      " |      the returned values\n",
      " |      \n",
      " |      >>> from sympy import separatevars, log\n",
      " |      >>> separatevars(exp(x+y)).as_independent(x)\n",
      " |      (exp(y), exp(x))\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> separatevars(x + x*y).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).expand(mul=True).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> a, b=symbols('a b', positive=True)\n",
      " |      >>> (log(a*b).expand(log=True)).as_independent(b)\n",
      " |      (log(a), log(b))\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      separatevars\n",
      " |      expand_log\n",
      " |      sympy.core.add.Add.as_two_terms\n",
      " |      sympy.core.mul.Mul.as_two_terms\n",
      " |      as_coeff_mul\n",
      " |  \n",
      " |  as_leading_term(self, *symbols, logx=None, cdir=0)\n",
      " |      Returns the leading (nonzero) term of the series expansion of self.\n",
      " |      \n",
      " |      The _eval_as_leading_term routines are used to do this, and they must\n",
      " |      always return a non-zero value.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + x**2).as_leading_term(x)\n",
      " |      1\n",
      " |      >>> (1/x**2 + x + x**2).as_leading_term(x)\n",
      " |      x**(-2)\n",
      " |  \n",
      " |  as_numer_denom(self)\n",
      " |      Return the numerator and the denominator of an expression.\n",
      " |      \n",
      " |      expression -> a/b -> a, b\n",
      " |      \n",
      " |      This is just a stub that should be defined by\n",
      " |      an object's class methods to get anything else.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      normal: return ``a/b`` instead of ``(a, b)``\n",
      " |  \n",
      " |  as_ordered_factors(self, order=None)\n",
      " |      Return list of ordered factors (if Mul) else [self].\n",
      " |  \n",
      " |  as_ordered_terms(self, order=None, data=False)\n",
      " |      Transform an expression to an ordered list of terms.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, cos\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> (sin(x)**2*cos(x) + sin(x)**2 + 1).as_ordered_terms()\n",
      " |      [sin(x)**2*cos(x), sin(x)**2, 1]\n",
      " |  \n",
      " |  as_poly(self, *gens, **args)\n",
      " |      Converts ``self`` to a polynomial or returns ``None``.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> print((x**2 + x*y).as_poly())\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |      \n",
      " |      >>> print((x**2 + x*y).as_poly(x, y))\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |      \n",
      " |      >>> print((x**2 + sin(y)).as_poly(x, y))\n",
      " |      None\n",
      " |  \n",
      " |  as_powers_dict(self)\n",
      " |      Return self as a dictionary of factors with each factor being\n",
      " |      treated as a power. The keys are the bases of the factors and the\n",
      " |      values, the corresponding exponents. The resulting dictionary should\n",
      " |      be used with caution if the expression is a Mul and contains non-\n",
      " |      commutative factors since the order that they appeared will be lost in\n",
      " |      the dictionary.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      as_ordered_factors: An alternative for noncommutative applications,\n",
      " |                          returning an ordered list of factors.\n",
      " |      args_cnc: Similar to as_ordered_factors, but guarantees separation\n",
      " |                of commutative and noncommutative factors.\n",
      " |  \n",
      " |  as_real_imag(self, deep=True, **hints)\n",
      " |      Performs complex expansion on 'self' and returns a tuple\n",
      " |      containing collected both real and imaginary parts. This\n",
      " |      method cannot be confused with re() and im() functions,\n",
      " |      which does not perform complex expansion at evaluation.\n",
      " |      \n",
      " |      However it is possible to expand both re() and im()\n",
      " |      functions and get exactly the same results as with\n",
      " |      a single call to this function.\n",
      " |      \n",
      " |      >>> from sympy import symbols, I\n",
      " |      \n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |      \n",
      " |      >>> (x + y*I).as_real_imag()\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> from sympy.abc import z, w\n",
      " |      \n",
      " |      >>> (z + w*I).as_real_imag()\n",
      " |      (re(z) - im(w), re(w) + im(z))\n",
      " |  \n",
      " |  as_terms(self)\n",
      " |      Transform an expression to a list of terms.\n",
      " |  \n",
      " |  aseries(self, x=None, n=6, bound=0, hir=False)\n",
      " |      Asymptotic Series expansion of self.\n",
      " |      This is equivalent to ``self.series(x, oo, n)``.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      self : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |      \n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |      \n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |      \n",
      " |      hir : Boolean\n",
      " |            Set this parameter to be True to produce hierarchical series.\n",
      " |            It stops the recursion at an early level and may provide nicer\n",
      " |            and more useful results.\n",
      " |      \n",
      " |      bound : Value, Integer\n",
      " |              Use the ``bound`` parameter to give limit on rewriting\n",
      " |              coefficients in its normalised form.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, exp\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> e = sin(1/x + exp(-x)) - sin(1/x)\n",
      " |      \n",
      " |      >>> e.aseries(x)\n",
      " |      (1/(24*x**4) - 1/(2*x**2) + 1 + O(x**(-6), (x, oo)))*exp(-x)\n",
      " |      \n",
      " |      >>> e.aseries(x, n=3, hir=True)\n",
      " |      -exp(-2*x)*sin(1/x)/2 + exp(-x)*cos(1/x) + O(exp(-3*x), (x, oo))\n",
      " |      \n",
      " |      >>> e = exp(exp(x)/(1 - 1/x))\n",
      " |      \n",
      " |      >>> e.aseries(x)\n",
      " |      exp(exp(x)/(1 - 1/x))\n",
      " |      \n",
      " |      >>> e.aseries(x, bound=3) # doctest: +SKIP\n",
      " |      exp(exp(x)/x**2)*exp(exp(x)/x)*exp(-exp(x) + exp(x)/(1 - 1/x) - exp(x)/x - exp(x)/x**2)*exp(exp(x))\n",
      " |      \n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).aseries(x, n=8)\n",
      " |      1/x\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      Expr\n",
      " |          Asymptotic series expansion of the expression.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      This algorithm is directly induced from the limit computational algorithm provided by Gruntz.\n",
      " |      It majorly uses the mrv and rewrite sub-routines. The overall idea of this algorithm is first\n",
      " |      to look for the most rapidly varying subexpression w of a given expression f and then expands f\n",
      " |      in a series in w. Then same thing is recursively done on the leading coefficient\n",
      " |      till we get constant coefficients.\n",
      " |      \n",
      " |      If the most rapidly varying subexpression of a given expression f is f itself,\n",
      " |      the algorithm tries to find a normalised representation of the mrv set and rewrites f\n",
      " |      using this normalised representation.\n",
      " |      \n",
      " |      If the expansion contains an order term, it will be either ``O(x ** (-n))`` or ``O(w ** (-n))``\n",
      " |      where ``w`` belongs to the most rapidly varying expression of ``self``.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] Gruntz, Dominik. A new algorithm for computing asymptotic series.\n",
      " |             In: Proc. 1993 Int. Symp. Symbolic and Algebraic Computation. 1993.\n",
      " |             pp. 239-244.\n",
      " |      .. [2] Gruntz thesis - p90\n",
      " |      .. [3] https://en.wikipedia.org/wiki/Asymptotic_expansion\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      Expr.aseries: See the docstring of this function for complete details of this wrapper.\n",
      " |  \n",
      " |  cancel(self, *gens, **args)\n",
      " |      See the cancel function in sympy.polys\n",
      " |  \n",
      " |  coeff(self, x, n=1, right=False, _first=True)\n",
      " |      Returns the coefficient from the term(s) containing ``x**n``. If ``n``\n",
      " |      is zero then all terms independent of ``x`` will be returned.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      When ``x`` is noncommutative, the coefficient to the left (default) or\n",
      " |      right of ``x`` can be returned. The keyword 'right' is ignored when\n",
      " |      ``x`` is commutative.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      You can select terms that have an explicit negative in front of them:\n",
      " |      \n",
      " |      >>> (-x + 2*y).coeff(-1)\n",
      " |      x\n",
      " |      >>> (x - 2*y).coeff(-1)\n",
      " |      2*y\n",
      " |      \n",
      " |      You can select terms with no Rational coefficient:\n",
      " |      \n",
      " |      >>> (x + 2*y).coeff(1)\n",
      " |      x\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(1)\n",
      " |      0\n",
      " |      \n",
      " |      You can select terms independent of x by making n=0; in this case\n",
      " |      expr.as_independent(x)[0] is returned (and 0 will be returned instead\n",
      " |      of None):\n",
      " |      \n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x, 0)\n",
      " |      3\n",
      " |      >>> eq = ((x + 1)**3).expand() + 1\n",
      " |      >>> eq\n",
      " |      x**3 + 3*x**2 + 3*x + 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 2]\n",
      " |      >>> eq -= 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 0]\n",
      " |      \n",
      " |      You can select terms that have a numerical term in front of them:\n",
      " |      \n",
      " |      >>> (-x - 2*y).coeff(2)\n",
      " |      -y\n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> (x + sqrt(2)*x).coeff(sqrt(2))\n",
      " |      x\n",
      " |      \n",
      " |      The matching is exact:\n",
      " |      \n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x)\n",
      " |      2\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**2)\n",
      " |      4\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**3)\n",
      " |      0\n",
      " |      >>> (z*(x + y)**2).coeff((x + y)**2)\n",
      " |      z\n",
      " |      >>> (z*(x + y)**2).coeff(x + y)\n",
      " |      0\n",
      " |      \n",
      " |      In addition, no factoring is done, so 1 + z*(1 + y) is not obtained\n",
      " |      from the following:\n",
      " |      \n",
      " |      >>> (x + z*(x + x*y)).coeff(x)\n",
      " |      1\n",
      " |      \n",
      " |      If such factoring is desired, factor_terms can be used first:\n",
      " |      \n",
      " |      >>> from sympy import factor_terms\n",
      " |      >>> factor_terms(x + z*(x + x*y)).coeff(x)\n",
      " |      z*(y + 1) + 1\n",
      " |      \n",
      " |      >>> n, m, o = symbols('n m o', commutative=False)\n",
      " |      >>> n.coeff(n)\n",
      " |      1\n",
      " |      >>> (3*n).coeff(n)\n",
      " |      3\n",
      " |      >>> (n*m + m*n*m).coeff(n) # = (1 + m)*n*m\n",
      " |      1 + m\n",
      " |      >>> (n*m + m*n*m).coeff(n, right=True) # = (1 + m)*n*m\n",
      " |      m\n",
      " |      \n",
      " |      If there is more than one possible coefficient 0 is returned:\n",
      " |      \n",
      " |      >>> (n*m + m*n).coeff(n)\n",
      " |      0\n",
      " |      \n",
      " |      If there is only one possible coefficient, it is returned:\n",
      " |      \n",
      " |      >>> (n*m + x*m*n).coeff(m*n)\n",
      " |      x\n",
      " |      >>> (n*m + x*m*n).coeff(m*n, right=1)\n",
      " |      1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      as_coefficient: separate the expression into a coefficient and factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |  \n",
      " |  collect(self, syms, func=None, evaluate=True, exact=False, distribute_order_term=True)\n",
      " |      See the collect function in sympy.simplify\n",
      " |  \n",
      " |  combsimp(self)\n",
      " |      See the combsimp function in sympy.simplify\n",
      " |  \n",
      " |  compute_leading_term(self, x, logx=None)\n",
      " |      Deprecated function to compute the leading term of a series.\n",
      " |      \n",
      " |      as_leading_term is only allowed for results of .series()\n",
      " |      This is a wrapper to compute a series first.\n",
      " |  \n",
      " |  conjugate(self)\n",
      " |      Returns the complex conjugate of 'self'.\n",
      " |  \n",
      " |  could_extract_minus_sign(self)\n",
      " |      Return True if self has -1 as a leading factor or has\n",
      " |      more literal negative signs than positive signs in a sum,\n",
      " |      otherwise False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = x - y\n",
      " |      >>> {i.could_extract_minus_sign() for i in (e, -e)}\n",
      " |      {False, True}\n",
      " |      \n",
      " |      Though the ``y - x`` is considered like ``-(x - y)``, since it\n",
      " |      is in a product without a leading factor of -1, the result is\n",
      " |      false below:\n",
      " |      \n",
      " |      >>> (x*(y - x)).could_extract_minus_sign()\n",
      " |      False\n",
      " |      \n",
      " |      To put something in canonical form wrt to sign, use `signsimp`:\n",
      " |      \n",
      " |      >>> from sympy import signsimp\n",
      " |      >>> signsimp(x*(y - x))\n",
      " |      -x*(x - y)\n",
      " |      >>> _.could_extract_minus_sign()\n",
      " |      True\n",
      " |  \n",
      " |  count_ops(self, visual=None)\n",
      " |      Wrapper for count_ops that returns the operation count.\n",
      " |  \n",
      " |  diff(self, *symbols, **assumptions)\n",
      " |  \n",
      " |  dir(self, x, cdir)\n",
      " |  \n",
      " |  equals(self, other, failing_expression=False)\n",
      " |      Return True if self == other, False if it does not, or None. If\n",
      " |      failing_expression is True then the expression which did not simplify\n",
      " |      to a 0 will be returned instead of None.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      If ``self`` is a Number (or complex number) that is not zero, then\n",
      " |      the result is False.\n",
      " |      \n",
      " |      If ``self`` is a number and has not evaluated to zero, evalf will be\n",
      " |      used to test whether the expression evaluates to zero. If it does so\n",
      " |      and the result has significance (i.e. the precision is either -1, for\n",
      " |      a Rational result, or is greater than 1) then the evalf value will be\n",
      " |      used to return True or False.\n",
      " |  \n",
      " |  expand(self, deep=True, modulus=None, power_base=True, power_exp=True, mul=True, log=True, multinomial=True, basic=True, **hints)\n",
      " |      Expand an expression using hints.\n",
      " |      \n",
      " |      See the docstring of the expand() function in sympy.core.function for\n",
      " |      more information.\n",
      " |  \n",
      " |  extract_additively(self, c)\n",
      " |      Return self - c if it's possible to subtract c from self and\n",
      " |      make all matching coefficients move towards zero, else return None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = 2*x + 3\n",
      " |      >>> e.extract_additively(x + 1)\n",
      " |      x + 2\n",
      " |      >>> e.extract_additively(3*x)\n",
      " |      >>> e.extract_additively(4)\n",
      " |      >>> (y*(x + 1)).extract_additively(x + 1)\n",
      " |      >>> ((x + 1)*(x + 2*y + 1) + 3).extract_additively(x + 1)\n",
      " |      (x + 1)*(x + 2*y) + 3\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      extract_multiplicatively\n",
      " |      coeff\n",
      " |      as_coefficient\n",
      " |  \n",
      " |  extract_branch_factor(self, allow_half=False)\n",
      " |      Try to write self as ``exp_polar(2*pi*I*n)*z`` in a nice way.\n",
      " |      Return (z, n).\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, I, pi\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> exp_polar(I*pi).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), 0)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor()\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(-pi*I).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), -1)\n",
      " |      >>> exp_polar(3*pi*I + x).extract_branch_factor()\n",
      " |      (exp_polar(x + I*pi), 1)\n",
      " |      >>> (y*exp_polar(-5*pi*I)*exp_polar(3*pi*I + 2*pi*x)).extract_branch_factor()\n",
      " |      (y*exp_polar(2*pi*x), -1)\n",
      " |      >>> exp_polar(-I*pi/2).extract_branch_factor()\n",
      " |      (exp_polar(-I*pi/2), 0)\n",
      " |      \n",
      " |      If allow_half is True, also extract exp_polar(I*pi):\n",
      " |      \n",
      " |      >>> exp_polar(I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1/2)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(3*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 3/2)\n",
      " |      >>> exp_polar(-I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, -1/2)\n",
      " |  \n",
      " |  extract_multiplicatively(self, c)\n",
      " |      Return None if it's not possible to make self in the form\n",
      " |      c * something in a nice way, i.e. preserving the properties\n",
      " |      of arguments of self.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Rational\n",
      " |      \n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |      \n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**2 * y)\n",
      " |      x*y**2\n",
      " |      \n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**4 * y)\n",
      " |      \n",
      " |      >>> (2*x).extract_multiplicatively(2)\n",
      " |      x\n",
      " |      \n",
      " |      >>> (2*x).extract_multiplicatively(3)\n",
      " |      \n",
      " |      >>> (Rational(1, 2)*x).extract_multiplicatively(3)\n",
      " |      x/6\n",
      " |  \n",
      " |  factor(self, *gens, **args)\n",
      " |      See the factor() function in sympy.polys.polytools\n",
      " |  \n",
      " |  fourier_series(self, limits=None)\n",
      " |      Compute fourier sine/cosine series of self.\n",
      " |      \n",
      " |      See the docstring of the :func:`fourier_series` in sympy.series.fourier\n",
      " |      for more information.\n",
      " |  \n",
      " |  fps(self, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False)\n",
      " |      Compute formal power power series of self.\n",
      " |      \n",
      " |      See the docstring of the :func:`fps` function in sympy.series.formal for\n",
      " |      more information.\n",
      " |  \n",
      " |  gammasimp(self)\n",
      " |      See the gammasimp function in sympy.simplify\n",
      " |  \n",
      " |  getO(self)\n",
      " |      Returns the additive O(..) symbol if there is one, else None.\n",
      " |  \n",
      " |  getn(self)\n",
      " |      Returns the order of the expression.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      The order is determined either from the O(...) term. If there\n",
      " |      is no O(...) term, it returns None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import O\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + O(x**2)).getn()\n",
      " |      2\n",
      " |      >>> (1 + x).getn()\n",
      " |  \n",
      " |  integrate(self, *args, **kwargs)\n",
      " |      See the integrate function in sympy.integrals\n",
      " |  \n",
      " |  invert(self, g, *gens, **args)\n",
      " |      Return the multiplicative inverse of ``self`` mod ``g``\n",
      " |      where ``self`` (and ``g``) may be symbolic expressions).\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      sympy.core.numbers.mod_inverse, sympy.polys.polytools.invert\n",
      " |  \n",
      " |  is_algebraic_expr(self, *syms)\n",
      " |      This tests whether a given expression is algebraic or not, in the\n",
      " |      given symbols, syms. When syms is not given, all free symbols\n",
      " |      will be used. The rational function does not have to be in expanded\n",
      " |      or in any kind of canonical form.\n",
      " |      \n",
      " |      This function returns False for expressions that are \"algebraic\n",
      " |      expressions\" with symbolic exponents. This is a simple extension to the\n",
      " |      is_rational_function, including rational exponentiation.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, sqrt\n",
      " |      >>> x = Symbol('x', real=True)\n",
      " |      >>> sqrt(1 + x).is_rational_function()\n",
      " |      False\n",
      " |      >>> sqrt(1 + x).is_algebraic_expr()\n",
      " |      True\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be an algebraic\n",
      " |      expression to become one.\n",
      " |      \n",
      " |      >>> from sympy import exp, factor\n",
      " |      >>> a = sqrt(exp(x)**2 + 2*exp(x) + 1)/(exp(x) + 1)\n",
      " |      >>> a.is_algebraic_expr(x)\n",
      " |      False\n",
      " |      >>> factor(a).is_algebraic_expr()\n",
      " |      True\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      is_rational_function\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Algebraic_expression\n",
      " |  \n",
      " |  is_constant(self, *wrt, **flags)\n",
      " |      Return True if self is constant, False if not, or None if\n",
      " |      the constancy could not be determined conclusively.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      If an expression has no free symbols then it is a constant. If\n",
      " |      there are free symbols it is possible that the expression is a\n",
      " |      constant, perhaps (but not necessarily) zero. To test such\n",
      " |      expressions, a few strategies are tried:\n",
      " |      \n",
      " |      1) numerical evaluation at two random points. If two such evaluations\n",
      " |      give two different values and the values have a precision greater than\n",
      " |      1 then self is not constant. If the evaluations agree or could not be\n",
      " |      obtained with any precision, no decision is made. The numerical testing\n",
      " |      is done only if ``wrt`` is different than the free symbols.\n",
      " |      \n",
      " |      2) differentiation with respect to variables in 'wrt' (or all free\n",
      " |      symbols if omitted) to see if the expression is constant or not. This\n",
      " |      will not always lead to an expression that is zero even though an\n",
      " |      expression is constant (see added test in test_expr.py). If\n",
      " |      all derivatives are zero then self is constant with respect to the\n",
      " |      given symbols.\n",
      " |      \n",
      " |      3) finding out zeros of denominator expression with free_symbols.\n",
      " |      It will not be constant if there are zeros. It gives more negative\n",
      " |      answers for expression that are not constant.\n",
      " |      \n",
      " |      If neither evaluation nor differentiation can prove the expression is\n",
      " |      constant, None is returned unless two numerical values happened to be\n",
      " |      the same and the flag ``failing_number`` is True -- in that case the\n",
      " |      numerical value will be returned.\n",
      " |      \n",
      " |      If flag simplify=False is passed, self will not be simplified;\n",
      " |      the default is True since self should be simplified before testing.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, Sum, S, pi\n",
      " |      >>> from sympy.abc import a, n, x, y\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> S(2).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, 10)).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant()\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(y)\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(n)\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(x)\n",
      " |      True\n",
      " |      >>> eq = a*cos(x)**2 + a*sin(x)**2 - a\n",
      " |      >>> eq.is_constant()\n",
      " |      True\n",
      " |      >>> eq.subs({x: pi, a: 2}) == eq.subs({x: pi, a: 3}) == 0\n",
      " |      True\n",
      " |      \n",
      " |      >>> (0**x).is_constant()\n",
      " |      False\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> (x**x).is_constant()\n",
      " |      False\n",
      " |      >>> one = cos(x)**2 + sin(x)**2\n",
      " |      >>> one.is_constant()\n",
      " |      True\n",
      " |      >>> ((one - 1)**(x + 1)).is_constant() in (True, False) # could be 0 or 1\n",
      " |      True\n",
      " |  \n",
      " |  is_meromorphic(self, x, a)\n",
      " |      This tests whether an expression is meromorphic as\n",
      " |      a function of the given symbol ``x`` at the point ``a``.\n",
      " |      \n",
      " |      This method is intended as a quick test that will return\n",
      " |      None if no decision can be made without simplification or\n",
      " |      more detailed analysis.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import zoo, log, sin, sqrt\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> f = 1/x**2 + 1 - 2*x**3\n",
      " |      >>> f.is_meromorphic(x, 0)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |      \n",
      " |      >>> g = x**log(3)\n",
      " |      >>> g.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> g.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> g.is_meromorphic(x, zoo)\n",
      " |      False\n",
      " |      \n",
      " |      >>> h = sin(1/x)*x**2\n",
      " |      >>> h.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> h.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> h.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |      \n",
      " |      Multivalued functions are considered meromorphic when their\n",
      " |      branches are meromorphic. Thus most functions are meromorphic\n",
      " |      everywhere except at essential singularities and branch points.\n",
      " |      In particular, they will be meromorphic also on branch cuts\n",
      " |      except at their endpoints.\n",
      " |      \n",
      " |      >>> log(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> log(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> sqrt(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> sqrt(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |  \n",
      " |  is_polynomial(self, *syms)\n",
      " |      Return True if self is a polynomial in syms and False otherwise.\n",
      " |      \n",
      " |      This checks if self is an exact polynomial in syms.  This function\n",
      " |      returns False for expressions that are \"polynomials\" with symbolic\n",
      " |      exponents.  Thus, you should be able to apply polynomial algorithms to\n",
      " |      expressions for which this returns True, and Poly(expr, \\*syms) should\n",
      " |      work if and only if expr.is_polynomial(\\*syms) returns True. The\n",
      " |      polynomial does not have to be in expanded form.  If no symbols are\n",
      " |      given, all free symbols in the expression will be used.\n",
      " |      \n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', polynomial=True).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, Function\n",
      " |      >>> x = Symbol('x')\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial(x)\n",
      " |      True\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial()\n",
      " |      True\n",
      " |      >>> (2**x + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (2**x + 1).is_polynomial(2**x)\n",
      " |      True\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (f(x) + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (f(x) + 1).is_polynomial(f(x))\n",
      " |      True\n",
      " |      >>> (1/f(x) + 1).is_polynomial(f(x))\n",
      " |      False\n",
      " |      \n",
      " |      >>> n = Symbol('n', nonnegative=True, integer=True)\n",
      " |      >>> (x**n + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a polynomial to\n",
      " |      become one.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, factor, cancel\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)\n",
      " |      >>> a.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      y + 1\n",
      " |      >>> factor(a).is_polynomial(y)\n",
      " |      True\n",
      " |      \n",
      " |      >>> b = (y**2 + 2*y + 1)/(y + 1)\n",
      " |      >>> b.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> cancel(b)\n",
      " |      y + 1\n",
      " |      >>> cancel(b).is_polynomial(y)\n",
      " |      True\n",
      " |      \n",
      " |      See also .is_rational_function()\n",
      " |  \n",
      " |  is_rational_function(self, *syms)\n",
      " |      Test whether function is a ratio of two polynomials in the given\n",
      " |      symbols, syms. When syms is not given, all free symbols will be used.\n",
      " |      The rational function does not have to be in expanded or in any kind of\n",
      " |      canonical form.\n",
      " |      \n",
      " |      This function returns False for expressions that are \"rational\n",
      " |      functions\" with symbolic exponents.  Thus, you should be able to call\n",
      " |      .as_numer_denom() and apply polynomial algorithms to the result for\n",
      " |      expressions for which this returns True.\n",
      " |      \n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', rational_function=True).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> (x/y).is_rational_function()\n",
      " |      True\n",
      " |      \n",
      " |      >>> (x**2).is_rational_function()\n",
      " |      True\n",
      " |      \n",
      " |      >>> (x/sin(y)).is_rational_function(y)\n",
      " |      False\n",
      " |      \n",
      " |      >>> n = Symbol('n', integer=True)\n",
      " |      >>> (x**n + 1).is_rational_function(x)\n",
      " |      False\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a rational function\n",
      " |      to become one.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, factor\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)/y\n",
      " |      >>> a.is_rational_function(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      (y + 1)/y\n",
      " |      >>> factor(a).is_rational_function(y)\n",
      " |      True\n",
      " |      \n",
      " |      See also is_algebraic_expr().\n",
      " |  \n",
      " |  leadterm(self, x, logx=None, cdir=0)\n",
      " |      Returns the leading term a*x**b as a tuple (a, b).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1+x+x**2).leadterm(x)\n",
      " |      (1, 0)\n",
      " |      >>> (1/x**2+x+x**2).leadterm(x)\n",
      " |      (1, -2)\n",
      " |  \n",
      " |  limit(self, x, xlim, dir='+')\n",
      " |      Compute limit x->xlim.\n",
      " |  \n",
      " |  lseries(self, x=None, x0=0, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper for series yielding an iterator of the terms of the series.\n",
      " |      \n",
      " |      Note: an infinite series will yield an infinite iterator. The following,\n",
      " |      for exaxmple, will never terminate. It will just keep printing terms\n",
      " |      of the sin(x) series::\n",
      " |      \n",
      " |        for term in sin(x).lseries(x):\n",
      " |            print term\n",
      " |      \n",
      " |      The advantage of lseries() over nseries() is that many times you are\n",
      " |      just interested in the next term in the series (i.e. the first term for\n",
      " |      example), but you do not know how many you should ask for in nseries()\n",
      " |      using the \"n\" parameter.\n",
      " |      \n",
      " |      See also nseries().\n",
      " |  \n",
      " |  normal(self)\n",
      " |      Return the expression as a fraction.\n",
      " |      \n",
      " |      expression -> a/b\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      as_numer_denom: return ``(a, b)`` instead of ``a/b``\n",
      " |  \n",
      " |  nseries(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper to _eval_nseries if assumptions allow, else to series.\n",
      " |      \n",
      " |      If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is\n",
      " |      called. This calculates \"n\" terms in the innermost expressions and\n",
      " |      then builds up the final series just by \"cross-multiplying\" everything\n",
      " |      out.\n",
      " |      \n",
      " |      The optional ``logx`` parameter can be used to replace any log(x) in the\n",
      " |      returned series with a symbolic value to avoid evaluating log(x) at 0. A\n",
      " |      symbol to use in place of log(x) should be provided.\n",
      " |      \n",
      " |      Advantage -- it's fast, because we do not have to determine how many\n",
      " |      terms we need to calculate in advance.\n",
      " |      \n",
      " |      Disadvantage -- you may end up with less terms than you may have\n",
      " |      expected, but the O(x**n) term appended will always be correct and\n",
      " |      so the result, though perhaps shorter, will also be correct.\n",
      " |      \n",
      " |      If any of those assumptions is not met, this is treated like a\n",
      " |      wrapper to series which will try harder to return the correct\n",
      " |      number of terms.\n",
      " |      \n",
      " |      See also lseries().\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, log, Symbol\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> sin(x).nseries(x, 0, 6)\n",
      " |      x - x**3/6 + x**5/120 + O(x**6)\n",
      " |      >>> log(x+1).nseries(x, 0, 5)\n",
      " |      x - x**2/2 + x**3/3 - x**4/4 + O(x**5)\n",
      " |      \n",
      " |      Handling of the ``logx`` parameter --- in the following example the\n",
      " |      expansion fails since ``sin`` does not have an asymptotic expansion\n",
      " |      at -oo (the limit of log(x) as x approaches 0):\n",
      " |      \n",
      " |      >>> e = sin(log(x))\n",
      " |      >>> e.nseries(x, 0, 6)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      PoleError: ...\n",
      " |      ...\n",
      " |      >>> logx = Symbol('logx')\n",
      " |      >>> e.nseries(x, 0, 6, logx=logx)\n",
      " |      sin(logx)\n",
      " |      \n",
      " |      In the following example, the expansion works but only returns self\n",
      " |      unless the ``logx`` parameter is used:\n",
      " |      \n",
      " |      >>> e = x**y\n",
      " |      >>> e.nseries(x, 0, 2)\n",
      " |      x**y\n",
      " |      >>> e.nseries(x, 0, 2, logx=logx)\n",
      " |      exp(logx*y)\n",
      " |  \n",
      " |  nsimplify(self, constants=(), tolerance=None, full=False)\n",
      " |      See the nsimplify function in sympy.simplify\n",
      " |  \n",
      " |  powsimp(self, *args, **kwargs)\n",
      " |      See the powsimp function in sympy.simplify\n",
      " |  \n",
      " |  primitive(self)\n",
      " |      Return the positive Rational that can be extracted non-recursively\n",
      " |      from every term of self (i.e., self is treated like an Add). This is\n",
      " |      like the as_coeff_Mul() method but primitive always extracts a positive\n",
      " |      Rational (never a negative or a Float).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (3*(x + 1)**2).primitive()\n",
      " |      (3, (x + 1)**2)\n",
      " |      >>> a = (6*x + 2); a.primitive()\n",
      " |      (2, 3*x + 1)\n",
      " |      >>> b = (x/2 + 3); b.primitive()\n",
      " |      (1/2, x + 6)\n",
      " |      >>> (a*b).primitive() == (1, a*b)\n",
      " |      True\n",
      " |  \n",
      " |  radsimp(self, **kwargs)\n",
      " |      See the radsimp function in sympy.simplify\n",
      " |  \n",
      " |  ratsimp(self)\n",
      " |      See the ratsimp function in sympy.simplify\n",
      " |  \n",
      " |  removeO(self)\n",
      " |      Removes the additive O(..) symbol if there is one\n",
      " |  \n",
      " |  round(self, n=None)\n",
      " |      Return x rounded to the given decimal place.\n",
      " |      \n",
      " |      If a complex number would results, apply round to the real\n",
      " |      and imaginary components of the number.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, E, I, S, Number\n",
      " |      >>> pi.round()\n",
      " |      3\n",
      " |      >>> pi.round(2)\n",
      " |      3.14\n",
      " |      >>> (2*pi + E*I).round()\n",
      " |      6 + 3*I\n",
      " |      \n",
      " |      The round method has a chopping effect:\n",
      " |      \n",
      " |      >>> (2*pi + I/10).round()\n",
      " |      6\n",
      " |      >>> (pi/10 + 2*I).round()\n",
      " |      2*I\n",
      " |      >>> (pi/10 + E*I).round(2)\n",
      " |      0.31 + 2.72*I\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      The Python ``round`` function uses the SymPy ``round`` method so it\n",
      " |      will always return a SymPy number (not a Python float or int):\n",
      " |      \n",
      " |      >>> isinstance(round(S(123), -2), Number)\n",
      " |      True\n",
      " |  \n",
      " |  separate(self, deep=False, force=False)\n",
      " |      See the separate function in sympy.simplify\n",
      " |  \n",
      " |  series(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Series expansion of \"self\" around ``x = x0`` yielding either terms of\n",
      " |      the series one by one (the lazy series given when n=None), else\n",
      " |      all the terms at once when n != None.\n",
      " |      \n",
      " |      Returns the series expansion of \"self\" around the point ``x = x0``\n",
      " |      with respect to ``x`` up to ``O((x - x0)**n, x, x0)`` (default n is 6).\n",
      " |      \n",
      " |      If ``x=None`` and ``self`` is univariate, the univariate symbol will\n",
      " |      be supplied, otherwise an error will be raised.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      expr : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |      \n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |      \n",
      " |      x0 : Value\n",
      " |           The value around which ``x`` is calculated. Can be any value\n",
      " |           from ``-oo`` to ``oo``.\n",
      " |      \n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |      \n",
      " |      dir : String, optional\n",
      " |            The series-expansion can be bi-directional. If ``dir=\"+\"``,\n",
      " |            then (x->x0+). If ``dir=\"-\", then (x->x0-). For infinite\n",
      " |            ``x0`` (``oo`` or ``-oo``), the ``dir`` argument is determined\n",
      " |            from the direction of the infinity (i.e., ``dir=\"-\"`` for\n",
      " |            ``oo``).\n",
      " |      \n",
      " |      logx : optional\n",
      " |             It is used to replace any log(x) in the returned series with a\n",
      " |             symbolic value rather than evaluating the actual value.\n",
      " |      \n",
      " |      cdir : optional\n",
      " |             It stands for complex direction, and indicates the direction\n",
      " |             from which the expansion needs to be evaluated.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cos, exp, tan\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> cos(x).series()\n",
      " |      1 - x**2/2 + x**4/24 + O(x**6)\n",
      " |      >>> cos(x).series(n=4)\n",
      " |      1 - x**2/2 + O(x**4)\n",
      " |      >>> cos(x).series(x, x0=1, n=2)\n",
      " |      cos(1) - (x - 1)*sin(1) + O((x - 1)**2, (x, 1))\n",
      " |      >>> e = cos(x + exp(y))\n",
      " |      >>> e.series(y, n=2)\n",
      " |      cos(x + 1) - y*sin(x + 1) + O(y**2)\n",
      " |      >>> e.series(x, n=2)\n",
      " |      cos(exp(y)) - x*sin(exp(y)) + O(x**2)\n",
      " |      \n",
      " |      If ``n=None`` then a generator of the series terms will be returned.\n",
      " |      \n",
      " |      >>> term=cos(x).series(n=None)\n",
      " |      >>> [next(term) for i in range(2)]\n",
      " |      [1, -x**2/2]\n",
      " |      \n",
      " |      For ``dir=+`` (default) the series is calculated from the right and\n",
      " |      for ``dir=-`` the series from the left. For smooth functions this\n",
      " |      flag will not alter the results.\n",
      " |      \n",
      " |      >>> abs(x).series(dir=\"+\")\n",
      " |      x\n",
      " |      >>> abs(x).series(dir=\"-\")\n",
      " |      -x\n",
      " |      >>> f = tan(x)\n",
      " |      >>> f.series(x, 2, 6, \"+\")\n",
      " |      tan(2) + (1 + tan(2)**2)*(x - 2) + (x - 2)**2*(tan(2)**3 + tan(2)) +\n",
      " |      (x - 2)**3*(1/3 + 4*tan(2)**2/3 + tan(2)**4) + (x - 2)**4*(tan(2)**5 +\n",
      " |      5*tan(2)**3/3 + 2*tan(2)/3) + (x - 2)**5*(2/15 + 17*tan(2)**2/15 +\n",
      " |      2*tan(2)**4 + tan(2)**6) + O((x - 2)**6, (x, 2))\n",
      " |      \n",
      " |      >>> f.series(x, 2, 3, \"-\")\n",
      " |      tan(2) + (2 - x)*(-tan(2)**2 - 1) + (2 - x)**2*(tan(2)**3 + tan(2))\n",
      " |      + O((x - 2)**3, (x, 2))\n",
      " |      \n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).series(x, n=8)\n",
      " |      1/x\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      Expr : Expression\n",
      " |          Series expansion of the expression about x0\n",
      " |      \n",
      " |      Raises\n",
      " |      ======\n",
      " |      \n",
      " |      TypeError\n",
      " |          If \"n\" and \"x0\" are infinity objects\n",
      " |      \n",
      " |      PoleError\n",
      " |          If \"x0\" is an infinity object\n",
      " |  \n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import S, I\n",
      " |      \n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |      \n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |  \n",
      " |  taylor_term(self, n, x, *previous_terms)\n",
      " |      General method for the taylor term.\n",
      " |      \n",
      " |      This method is slow, because it differentiates n-times. Subclasses can\n",
      " |      redefine it to make it faster by using the \"previous_terms\".\n",
      " |  \n",
      " |  together(self, *args, **kwargs)\n",
      " |      See the together function in sympy.polys\n",
      " |  \n",
      " |  transpose(self)\n",
      " |  \n",
      " |  trigsimp(self, **args)\n",
      " |      See the trigsimp function in sympy.simplify\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  expr_free_symbols\n",
      " |      Like ``free_symbols``, but returns the free symbols only if\n",
      " |      they are contained in an expression node.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (x + y).expr_free_symbols # doctest: +SKIP\n",
      " |      {x, y}\n",
      " |      \n",
      " |      If the expression is contained in a non-expression object, do not return\n",
      " |      the free symbols. Compare:\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> t = Tuple(x + y)\n",
      " |      >>> t.expr_free_symbols # doctest: +SKIP\n",
      " |      set()\n",
      " |      >>> t.free_symbols\n",
      " |      {x, y}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  is_scalar = True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |      \n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      from https://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |  \n",
      " |  __getnewargs__(self)\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __hash__(self) -> 'int'\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __ne__(self, other)\n",
      " |      ``a != b``  -> Compare two symbolic trees and see whether they are different\n",
      " |      \n",
      " |      this is the same as:\n",
      " |      \n",
      " |      ``a.compare(b) != 0``\n",
      " |      \n",
      " |      but faster\n",
      " |  \n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |  \n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |      \n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |      \n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |      \n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |      \n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |      \n",
      " |      The type can be given implicitly, too:\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |      \n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |      \n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |  \n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |      \n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |  \n",
      " |  copy(self)\n",
      " |  \n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |  \n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> u = Dummy('u')\n",
      " |      \n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |      \n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |  \n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |  \n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |      \n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |      \n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |      \n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |      \n",
      " |      \n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |      \n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |  \n",
      " |  has_free(self, *patterns)\n",
      " |      Return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |      \n",
      " |      This works for subexpressions and types, too:\n",
      " |      \n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |  \n",
      " |  has_xfree(self, s: 'set[Basic]')\n",
      " |      Return True if self has any of the patterns in s as a\n",
      " |      free argument, else False. This is like `Basic.has_free`\n",
      " |      but this will only report exact argument matches.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> f(x).has_xfree({f})\n",
      " |      False\n",
      " |      >>> f(x).has_xfree({f(x)})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x + 1})\n",
      " |      True\n",
      " |      >>> f(x + y + 1).has_xfree({x + 1})\n",
      " |      False\n",
      " |  \n",
      " |  is_hypergeometric(self, k)\n",
      " |  \n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |      \n",
      " |      Wild symbols match all.\n",
      " |      \n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |      \n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |      \n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |      \n",
      " |      But they can be identified if desired:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |      \n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |      \n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |  \n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |  \n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |      \n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |      \n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |      \n",
      " |      however, you can use:\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |  \n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |  \n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |      \n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself does not match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |      \n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |      \n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |      \n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      Initial setup\n",
      " |      \n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |      \n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |      \n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |      \n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |      \n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |      \n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |      \n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |      \n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |      \n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |      \n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |      \n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |      \n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |      \n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |      \n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |      \n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |      \n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |      \n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |      \n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |      \n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |      \n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |      \n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |      \n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |      \n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |      \n",
      " |      Here, we want `exact=False`:\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |      \n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |      \n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |      \n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |      \n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |  \n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |      \n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |      \n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      args : Expr\n",
      " |          A *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |      \n",
      " |      deep : bool, optional\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |      \n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |      \n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |      \n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |      \n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |  \n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |  \n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |      \n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |      \n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |      \n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |      \n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |      \n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |      \n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |      \n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |      \n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |      \n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |      \n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |      \n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |      \n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |      \n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |      \n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |      \n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |      \n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |      \n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |      \n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |      \n",
      " |      rather than\n",
      " |      \n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |      \n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |  \n",
      " |  xreplace(self, rule)\n",
      " |      Replace occurrences of objects within the expression.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      rule : dict-like\n",
      " |          Expresses a replacement rule\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      xreplace : the result of the replacement\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, pi, exp\n",
      " |      >>> x, y, z = symbols('x y z')\n",
      " |      >>> (1 + x*y).xreplace({x: pi})\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).xreplace({x: pi, y: 2})\n",
      " |      1 + 2*pi\n",
      " |      \n",
      " |      Replacements occur only if an entire node in the expression tree is\n",
      " |      matched:\n",
      " |      \n",
      " |      >>> (x*y + z).xreplace({x*y: pi})\n",
      " |      z + pi\n",
      " |      >>> (x*y*z).xreplace({x*y: pi})\n",
      " |      x*y*z\n",
      " |      >>> (2*x).xreplace({2*x: y, x: z})\n",
      " |      y\n",
      " |      >>> (2*2*x).xreplace({2*x: y, x: z})\n",
      " |      4*z\n",
      " |      >>> (x + y + 2).xreplace({x + y: 2})\n",
      " |      x + y + 2\n",
      " |      >>> (x + 2 + exp(x + 2)).xreplace({x + 2: y})\n",
      " |      x + exp(y) + 2\n",
      " |      \n",
      " |      xreplace does not differentiate between free and bound symbols. In the\n",
      " |      following, subs(x, y) would not change x since it is a bound symbol,\n",
      " |      but xreplace does:\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: y})\n",
      " |      Integral(y, (y, 1, 2*y))\n",
      " |      \n",
      " |      Trying to replace x with an expression raises an error:\n",
      " |      \n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: 2*y}) # doctest: +SKIP\n",
      " |      ValueError: Invalid limits given: ((2*y, 1, 4*y),)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __init_subclass__() from builtins.type\n",
      " |      This method is called when a class is subclassed.\n",
      " |      \n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |  \n",
      " |  class_key() from builtins.type\n",
      " |      Nice order of classes.\n",
      " |  \n",
      " |  fromiter(args, **assumptions) from builtins.type\n",
      " |      Create a new object from an iterable.\n",
      " |      \n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __sympy__\n",
      " |  \n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |      \n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |      \n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Do not override .args() from Basic (so that it is easy to\n",
      " |      change the interface in the future if needed).\n",
      " |  \n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |      \n",
      " |      For example:\n",
      " |      \n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |      \n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |  \n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |  \n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |      \n",
      " |      The following should hold for all objects::\n",
      " |      \n",
      " |          >> x == x.func(*x.args)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |  \n",
      " |  is_algebraic\n",
      " |  \n",
      " |  is_antihermitian\n",
      " |  \n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |      \n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |  \n",
      " |  is_complex\n",
      " |  \n",
      " |  is_composite\n",
      " |  \n",
      " |  is_even\n",
      " |  \n",
      " |  is_extended_negative\n",
      " |  \n",
      " |  is_extended_nonnegative\n",
      " |  \n",
      " |  is_extended_nonpositive\n",
      " |  \n",
      " |  is_extended_nonzero\n",
      " |  \n",
      " |  is_extended_positive\n",
      " |  \n",
      " |  is_extended_real\n",
      " |  \n",
      " |  is_finite\n",
      " |  \n",
      " |  is_hermitian\n",
      " |  \n",
      " |  is_imaginary\n",
      " |  \n",
      " |  is_infinite\n",
      " |  \n",
      " |  is_integer\n",
      " |  \n",
      " |  is_irrational\n",
      " |  \n",
      " |  is_negative\n",
      " |  \n",
      " |  is_noninteger\n",
      " |  \n",
      " |  is_nonnegative\n",
      " |  \n",
      " |  is_nonpositive\n",
      " |  \n",
      " |  is_nonzero\n",
      " |  \n",
      " |  is_odd\n",
      " |  \n",
      " |  is_polar\n",
      " |  \n",
      " |  is_positive\n",
      " |  \n",
      " |  is_prime\n",
      " |  \n",
      " |  is_rational\n",
      " |  \n",
      " |  is_real\n",
      " |  \n",
      " |  is_transcendental\n",
      " |  \n",
      " |  is_zero\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  is_Add = False\n",
      " |  \n",
      " |  is_AlgebraicNumber = False\n",
      " |  \n",
      " |  is_Atom = False\n",
      " |  \n",
      " |  is_Boolean = False\n",
      " |  \n",
      " |  is_Derivative = False\n",
      " |  \n",
      " |  is_Dummy = False\n",
      " |  \n",
      " |  is_Equality = False\n",
      " |  \n",
      " |  is_Float = False\n",
      " |  \n",
      " |  is_Function = False\n",
      " |  \n",
      " |  is_Indexed = False\n",
      " |  \n",
      " |  is_Integer = False\n",
      " |  \n",
      " |  is_MatAdd = False\n",
      " |  \n",
      " |  is_MatMul = False\n",
      " |  \n",
      " |  is_Matrix = False\n",
      " |  \n",
      " |  is_Mul = False\n",
      " |  \n",
      " |  is_Not = False\n",
      " |  \n",
      " |  is_Number = False\n",
      " |  \n",
      " |  is_NumberSymbol = False\n",
      " |  \n",
      " |  is_Order = False\n",
      " |  \n",
      " |  is_Piecewise = False\n",
      " |  \n",
      " |  is_Point = False\n",
      " |  \n",
      " |  is_Poly = False\n",
      " |  \n",
      " |  is_Pow = False\n",
      " |  \n",
      " |  is_Rational = False\n",
      " |  \n",
      " |  is_Relational = False\n",
      " |  \n",
      " |  is_Symbol = False\n",
      " |  \n",
      " |  is_Vector = False\n",
      " |  \n",
      " |  is_Wild = False\n",
      " |  \n",
      " |  is_symbol = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.printing.defaults.Printable:\n",
      " |  \n",
      " |  __repr__ = __str__(self)\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |  \n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |      \n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |      \n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |      \n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |      \n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |      \n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |      \n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |      \n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |      \n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |      \n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |      \n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |  \n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "338beedd",
   "metadata": {},
   "outputs": [],
   "source": [
    "sn=Sum(expr,(n,1,m)).doit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "36c820de",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{m^{2}}{4} + \\frac{3 m}{4}$"
      ],
      "text/plain": [
       "m**2/4 + 3*m/4"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "b3a9c0a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{n^{2}}{4} + \\frac{3 n}{4}$"
      ],
      "text/plain": [
       "n**2/4 + 3*n/4"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(expr**2+(expr-1)/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "bf517ae2",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr2=expr/2**n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "0c3455d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2^{- n} \\left(\\frac{n}{2} + \\frac{1}{2}\\right)$"
      ],
      "text/plain": [
       "(n/2 + 1/2)/2**n"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "8cb17418",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{2^{- m} \\left(3 \\cdot 2^{m} - m - 3\\right)}{2}$"
      ],
      "text/plain": [
       "(3*2**m - m - 3)/(2*2**m)"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(simplify(Sum(expr2,(n,1,m)).doit()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "b2033fa6",
   "metadata": {},
   "outputs": [],
   "source": [
    "f=x*exp(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "5822b6cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x e^{x}$"
      ],
      "text/plain": [
       "x*exp(x)"
      ]
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "31568574",
   "metadata": {},
   "outputs": [],
   "source": [
    "g=x**2+2*x+m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "33cd5d51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle m + x^{2} + 2 x$"
      ],
      "text/plain": [
       "m + x**2 + 2*x"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "8b692ae9",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=f+g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "1f6cdf4d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle m + x^{2} + x e^{x} + 2 x$"
      ],
      "text/plain": [
       "m + x**2 + x*exp(x) + 2*x"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "4ea06c92",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x e^{x} + 2 x + e^{x} + 2$"
      ],
      "text/plain": [
       "x*exp(x) + 2*x + exp(x) + 2"
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff(expr,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "7f03c720",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(x + 1\\right) \\left(e^{x} + 2\\right)$"
      ],
      "text/plain": [
       "(x + 1)*(exp(x) + 2)"
      ]
     },
     "execution_count": 136,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "96cc1082",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle m - 1 - e^{-1}$"
      ],
      "text/plain": [
       "m - 1 - exp(-1)"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.subs(x,-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "0ec55d0f",
   "metadata": {},
   "outputs": [],
   "source": [
    "F=Point(0,1/S(4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "id": "79c39579",
   "metadata": {},
   "outputs": [],
   "source": [
    "p=Parabola(F,Line(y+S(1)/4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "id": "08e119a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - x^{2} + y$"
      ],
      "text/plain": [
       "-x**2 + y"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "id": "99c84502",
   "metadata": {},
   "outputs": [],
   "source": [
    "x1,x2=symbols(\"x1:3\",real = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "id": "f99274a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "y1,y2=symbols(\"y1:3\",real = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "id": "be2b8532",
   "metadata": {},
   "outputs": [],
   "source": [
    "p=symbols(\"p\",positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "id": "2930166c",
   "metadata": {},
   "outputs": [],
   "source": [
    "S=Point(x1,y1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "id": "fa71d5fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "T=Point(x2,y2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "id": "d1388e05",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(x_{1}, y_{1}\\right)$"
      ],
      "text/plain": [
       "Point2D(x1, y1)"
      ]
     },
     "execution_count": 147,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "id": "bcab30e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(x_{2}, y_{2}\\right)$"
      ],
      "text/plain": [
       "Point2D(x2, y2)"
      ]
     },
     "execution_count": 148,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "17571dcc",
   "metadata": {},
   "outputs": [],
   "source": [
    "F=Point(0,p/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "id": "fd84868b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(0, \\frac{p}{2}\\right)$"
      ],
      "text/plain": [
       "Point2D(0, p/2)"
      ]
     },
     "execution_count": 151,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "F"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "id": "e07e187b",
   "metadata": {},
   "outputs": [],
   "source": [
    "FS=S-F"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "id": "097fa01a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(x_{1}, - \\frac{p}{2} + y_{1}\\right)$"
      ],
      "text/plain": [
       "Point2D(x1, -p/2 + y1)"
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "id": "af4cc4ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "FT=T-F"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "id": "94b6dba6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(x_{2}, - \\frac{p}{2} + y_{2}\\right)$"
      ],
      "text/plain": [
       "Point2D(x2, -p/2 + y2)"
      ]
     },
     "execution_count": 155,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "id": "c904a366",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x_{1} x_{2} + \\left(- \\frac{p}{2} + y_{1}\\right) \\left(- \\frac{p}{2} + y_{2}\\right)$"
      ],
      "text/plain": [
       "x1*x2 + (-p/2 + y1)*(-p/2 + y2)"
      ]
     },
     "execution_count": 163,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(Matrix(FS).T*Matrix(FT))[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "id": "b108d67b",
   "metadata": {},
   "outputs": [],
   "source": [
    "check=_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "id": "7dccad39",
   "metadata": {},
   "outputs": [],
   "source": [
    "data={y1:x1**2/(2*p),y2:x2**2/(2*p)}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "id": "0c58d50d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{y1: x1**2/(2*p), y2: x2**2/(2*p)}"
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "id": "7cbc5309",
   "metadata": {},
   "outputs": [],
   "source": [
    "key=check.subs(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "id": "ecd0f42b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\left(p^{2} - p x_{1} + p x_{2} + x_{1} x_{2}\\right) \\left(p^{2} + p x_{1} - p x_{2} + x_{1} x_{2}\\right)}{4 p^{2}}$"
      ],
      "text/plain": [
       "(p**2 - p*x1 + p*x2 + x1*x2)*(p**2 + p*x1 - p*x2 + x1*x2)/(4*p**2)"
      ]
     },
     "execution_count": 172,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(expand(key))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7bc37b11",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "id": "fe82d357",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Point(0,0,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "id": "cb0b10d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "P=Point(0,0,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "id": "1f43e265",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Point(0,2,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "id": "cfc39ae6",
   "metadata": {},
   "outputs": [],
   "source": [
    "C=Point(sqrt(3),1,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "id": "c63f8cd0",
   "metadata": {},
   "outputs": [],
   "source": [
    "D=Point(sqrt(3),-1,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "id": "7e764fa2",
   "metadata": {},
   "outputs": [],
   "source": [
    "E=(D+P)/2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "id": "206cbbc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b=symbols(\"a,b\",real = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "id": "70238111",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=Point(0,a,b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "id": "70c3c95f",
   "metadata": {},
   "outputs": [],
   "source": [
    "AC=C-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "id": "b83e598d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point3D}\\left(\\sqrt{3}, 1, 0\\right)$"
      ],
      "text/plain": [
       "Point3D(sqrt(3), 1, 0)"
      ]
     },
     "execution_count": 203,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "id": "18cde495",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point3D}\\left(\\frac{\\sqrt{3}}{2}, - \\frac{1}{2}, 1\\right)$"
      ],
      "text/plain": [
       "Point3D(sqrt(3)/2, -1/2, 1)"
      ]
     },
     "execution_count": 204,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "E-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "id": "8d290e6f",
   "metadata": {},
   "outputs": [],
   "source": [
    "BM=M-B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 207,
   "id": "60eb2b65",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point3D}\\left(0, a - 2, b\\right)$"
      ],
      "text/plain": [
       "Point3D(0, a - 2, b)"
      ]
     },
     "execution_count": 207,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "id": "83b2286a",
   "metadata": {},
   "outputs": [],
   "source": [
    "BP=P-B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "id": "4cde05f5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point3D}\\left(0, -2, 2\\right)$"
      ],
      "text/plain": [
       "Point3D(0, -2, 2)"
      ]
     },
     "execution_count": 208,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "id": "1dfd3a28",
   "metadata": {},
   "outputs": [],
   "source": [
    "AM=M-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "id": "c4060607",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point3D}\\left(0, a, b\\right)$"
      ],
      "text/plain": [
       "Point3D(0, a, b)"
      ]
     },
     "execution_count": 210,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "77a8025d",
   "metadata": {},
   "outputs": [],
   "source": [
    "p=symbols(\"p\",positive = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "fb7f672f",
   "metadata": {},
   "outputs": [],
   "source": [
    "l=Line(Point(p/2,0),slope=sqrt(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "add5100c",
   "metadata": {},
   "outputs": [],
   "source": [
    "para=Parabola(Point(p/2,0),Line(x+p/2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "37a0682b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 p x - y^{2}$"
      ],
      "text/plain": [
       "2*p*x - y**2"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "para.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "6be2a9c0",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function line_and_quadratic in module quadratic_function.utils:\n",
      "\n",
      "line_and_quadratic(line, quadra, x=x, y=y  , first=True) -> sympy.core.expr.Expr\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(line_and_quadratic)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "93521145",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 3 p^{2} + 2 \\sqrt{3} p y   - 3 y  ^{2}$"
      ],
      "text/plain": [
       "3*p**2 + 2*sqrt(3)*p*y   - 3*y  **2"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "line_and_quadratic(l,para,y=y,first=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c1b12a23",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(_,x=y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "c06a58ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{- \\frac{\\sqrt{3} p}{3}, \\sqrt{3} p\\right\\}$"
      ],
      "text/plain": [
       "{-sqrt(3)*p/3, sqrt(3)*p}"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.roots"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "983cce49",
   "metadata": {},
   "source": [
    "## 初中七年级试卷（学业水平单元卷）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "443a7da6",
   "metadata": {},
   "outputs": [],
   "source": [
    "def dotrun(a,b):\n",
    "    return a*b/(a+b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "011bbcef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.4"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dotrun(dotrun(2,-3),4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "0e557887",
   "metadata": {},
   "outputs": [],
   "source": [
    "def dotrun(a,b):\n",
    "    return 3*a+2*b-1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "8953ee35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dotrun(-4,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "c65d218e",
   "metadata": {},
   "outputs": [],
   "source": [
    "data=[10,-2,+3,-1,9,-3,-2,11,3,-4,6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "5ee9b69d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "fb1e2591",
   "metadata": {},
   "outputs": [],
   "source": [
    "from functools import reduce"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "0f366785",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "151.2"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reduce(lambda x,y:abs(x)+abs(y),data)*2.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "5e7107f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "def whatsnum(n):\n",
    "    if(n==1):\n",
    "        return S(1)/2\n",
    "    else:\n",
    "        return 1/(1-whatsnum(n-1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "45811ad7",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1/2\n",
      "2\n",
      "-1\n",
      "1/2\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,6):\n",
    "    print(whatsnum(i))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "72e4c7f6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{1}{2}$"
      ],
      "text/plain": [
       "1/2"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "whatsnum(2023)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "643b2eb5",
   "metadata": {},
   "source": [
    "### 第二卷A"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9eb9d96b",
   "metadata": {},
   "source": [
    "- 19题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "974fa37d",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = 3*x**2-(7*x-(4*x-3)-2*x**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "56094728",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 5 x^{2} - 3 x - 3$"
      ],
      "text/plain": [
       "5*x**2 - 3*x - 3"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "c0a30094",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method from_dict in module sympy.polys.polytools:\n",
      "\n",
      "from_dict(rep, *gens, **args) method of builtins.type instance\n",
      "    Construct a polynomial from a ``dict``.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Poly.from_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "b4be258f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{(1, 0): 2, (1, 1): 3, (2, 4): 7}"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Poly(3*x*y+2*x+7*x**2*y**4).as_dict()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "1a5b9d8d",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c = symbols(\"a,b,c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "2410e48b",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Poly.from_dict({(2,1):3,(1,2):3,(0,4):1},(a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "fc8dc84c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Poly}{\\left( 3 a^{2}b + 3 ab^{2} + b^{4}, a, b, domain=\\mathbb{Z} \\right)}$"
      ],
      "text/plain": [
       "Poly(3*a**2*b + 3*a*b**2 + b**4, a, b, domain='ZZ')"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "b721595a",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Poly.from_dict({(2,1):1,(1,2):11,(4,0):1},(a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "afd11770",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Poly}{\\left( a^{4} + a^{2}b + 11 ab^{2}, a, b, domain=\\mathbb{Z} \\right)}$"
      ],
      "text/plain": [
       "Poly(a**4 + a**2*b + 11*a*b**2, a, b, domain='ZZ')"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "2af32a2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "C=Poly.from_dict({(2,1,0):2,(1,2,0):-8,(0,0,4):1},(a,b,c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "250bafd9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Poly}{\\left( 2 a^{2}b - 8 ab^{2} + c^{4}, a, b, c, domain=\\mathbb{Z} \\right)}$"
      ],
      "text/plain": [
       "Poly(2*a**2*b - 8*a*b**2 + c**4, a, b, c, domain='ZZ')"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "31138a8c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle a^{4} + 2 a^{2} b + 22 a b^{2} + b^{4} - c^{4}$"
      ],
      "text/plain": [
       "a**4 + 2*a**2*b + 22*a*b**2 + b**4 - c**4"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(A+B-C).as_expr()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98e91e13",
   "metadata": {},
   "source": [
    "### 第三章A卷"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "7426285c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{3\\right\\}$"
      ],
      "text/plain": [
       "{3}"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq(y-(y+1)/2,2-(y+2)/5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "b8bf02c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{10\\right\\}$"
      ],
      "text/plain": [
       "{10}"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq((x-4)/3-8,-(x+2)/2),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "fc4f6a94",
   "metadata": {},
   "outputs": [],
   "source": [
    "def test(a,b):\n",
    "    return a/S(3)-S(2)*b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "2a42edf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{0\\right\\}$"
      ],
      "text/plain": [
       "{0}"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq(test(3,x),1),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "aae865d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "def price(a,b):\n",
    "    return S(180)/1500*abs(a-b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "36c0949a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{3}{25}$"
      ],
      "text/plain": [
       "3/25"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "price(2,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "f674a616",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 153.72$"
      ],
      "text/plain": [
       "153.720000000000"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(price(1500,219))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "f79cb461",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 87.36$"
      ],
      "text/plain": [
       "87.3600000000000"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(price(1130,402))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c86072c0",
   "metadata": {},
   "source": [
    "### 第三章B卷"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "a889cb7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{- \\frac{17}{2}\\right\\}$"
      ],
      "text/plain": [
       "{-17/2}"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq((x-1)/4+5,(2-x)/4))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be520c47",
   "metadata": {},
   "source": [
    "### 期末测试卷"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "b73c8476",
   "metadata": {},
   "outputs": [],
   "source": [
    "def newrun(a,b):\n",
    "    return 3*a-2*b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "e1ebc6dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-4"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "newrun(2,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "128ff0ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "newrun(2,-5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f5984b07",
   "metadata": {},
   "source": [
    "### 八年级第十二章"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "6d3efd15",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class Triangle in module sympy.geometry.polygon:\n",
      "\n",
      "class Triangle(Polygon)\n",
      " |  Triangle(*args, **kwargs)\n",
      " |  \n",
      " |  A polygon with three vertices and three sides.\n",
      " |  \n",
      " |  Parameters\n",
      " |  ==========\n",
      " |  \n",
      " |  points : sequence of Points\n",
      " |  keyword: asa, sas, or sss to specify sides/angles of the triangle\n",
      " |  \n",
      " |  Attributes\n",
      " |  ==========\n",
      " |  \n",
      " |  vertices\n",
      " |  altitudes\n",
      " |  orthocenter\n",
      " |  circumcenter\n",
      " |  circumradius\n",
      " |  circumcircle\n",
      " |  inradius\n",
      " |  incircle\n",
      " |  exradii\n",
      " |  medians\n",
      " |  medial\n",
      " |  nine_point_circle\n",
      " |  \n",
      " |  Raises\n",
      " |  ======\n",
      " |  \n",
      " |  GeometryError\n",
      " |      If the number of vertices is not equal to three, or one of the vertices\n",
      " |      is not a Point, or a valid keyword is not given.\n",
      " |  \n",
      " |  See Also\n",
      " |  ========\n",
      " |  \n",
      " |  sympy.geometry.point.Point, Polygon\n",
      " |  \n",
      " |  Examples\n",
      " |  ========\n",
      " |  \n",
      " |  >>> from sympy import Triangle, Point\n",
      " |  >>> Triangle(Point(0, 0), Point(4, 0), Point(4, 3))\n",
      " |  Triangle(Point2D(0, 0), Point2D(4, 0), Point2D(4, 3))\n",
      " |  \n",
      " |  Keywords sss, sas, or asa can be used to give the desired\n",
      " |  side lengths (in order) and interior angles (in degrees) that\n",
      " |  define the triangle:\n",
      " |  \n",
      " |  >>> Triangle(sss=(3, 4, 5))\n",
      " |  Triangle(Point2D(0, 0), Point2D(3, 0), Point2D(3, 4))\n",
      " |  >>> Triangle(asa=(30, 1, 30))\n",
      " |  Triangle(Point2D(0, 0), Point2D(1, 0), Point2D(1/2, sqrt(3)/6))\n",
      " |  >>> Triangle(sas=(1, 45, 2))\n",
      " |  Triangle(Point2D(0, 0), Point2D(2, 0), Point2D(sqrt(2)/2, sqrt(2)/2))\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      Triangle\n",
      " |      Polygon\n",
      " |      sympy.geometry.entity.GeometrySet\n",
      " |      sympy.geometry.entity.GeometryEntity\n",
      " |      sympy.sets.sets.Set\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  bisectors(self)\n",
      " |      The angle bisectors of the triangle.\n",
      " |      \n",
      " |      An angle bisector of a triangle is a straight line through a vertex\n",
      " |      which cuts the corresponding angle in half.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      bisectors : dict\n",
      " |          Each key is a vertex (Point) and each value is the corresponding\n",
      " |          bisector (Segment).\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.line.Segment\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle, Segment\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> t.bisectors()[p2] == Segment(Point(1, 0), Point(0, sqrt(2) - 1))\n",
      " |      True\n",
      " |  \n",
      " |  is_equilateral(self)\n",
      " |      Are all the sides the same length?\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_equilateral : boolean\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.entity.GeometryEntity.is_similar, RegularPolygon\n",
      " |      is_isosceles, is_right, is_scalene\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))\n",
      " |      >>> t1.is_equilateral()\n",
      " |      False\n",
      " |      \n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> t2 = Triangle(Point(0, 0), Point(10, 0), Point(5, 5*sqrt(3)))\n",
      " |      >>> t2.is_equilateral()\n",
      " |      True\n",
      " |  \n",
      " |  is_isosceles(self)\n",
      " |      Are two or more of the sides the same length?\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_isosceles : boolean\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      is_equilateral, is_right, is_scalene\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(2, 4))\n",
      " |      >>> t1.is_isosceles()\n",
      " |      True\n",
      " |  \n",
      " |  is_right(self)\n",
      " |      Is the triangle right-angled.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_right : boolean\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.line.LinearEntity.is_perpendicular\n",
      " |      is_equilateral, is_isosceles, is_scalene\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))\n",
      " |      >>> t1.is_right()\n",
      " |      True\n",
      " |  \n",
      " |  is_scalene(self)\n",
      " |      Are all the sides of the triangle of different lengths?\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_scalene : boolean\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      is_equilateral, is_isosceles, is_right\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(1, 4))\n",
      " |      >>> t1.is_scalene()\n",
      " |      True\n",
      " |  \n",
      " |  is_similar(t1, t2)\n",
      " |      Is another triangle similar to this one.\n",
      " |      \n",
      " |      Two triangles are similar if one can be uniformly scaled to the other.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      other: Triangle\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_similar : boolean\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.entity.GeometryEntity.is_similar\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))\n",
      " |      >>> t2 = Triangle(Point(0, 0), Point(-4, 0), Point(-4, -3))\n",
      " |      >>> t1.is_similar(t2)\n",
      " |      True\n",
      " |      \n",
      " |      >>> t2 = Triangle(Point(0, 0), Point(-4, 0), Point(-4, -4))\n",
      " |      >>> t1.is_similar(t2)\n",
      " |      False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(cls, *args, **kwargs)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties defined here:\n",
      " |  \n",
      " |  altitudes\n",
      " |      The altitudes of the triangle.\n",
      " |      \n",
      " |      An altitude of a triangle is a segment through a vertex,\n",
      " |      perpendicular to the opposite side, with length being the\n",
      " |      height of the vertex measured from the line containing the side.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      altitudes : dict\n",
      " |          The dictionary consists of keys which are vertices and values\n",
      " |          which are Segments.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.line.Segment.length\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.altitudes[p1]\n",
      " |      Segment2D(Point2D(0, 0), Point2D(1/2, 1/2))\n",
      " |  \n",
      " |  circumcenter\n",
      " |      The circumcenter of the triangle\n",
      " |      \n",
      " |      The circumcenter is the center of the circumcircle.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      circumcenter : Point\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.circumcenter\n",
      " |      Point2D(1/2, 1/2)\n",
      " |  \n",
      " |  circumcircle\n",
      " |      The circle which passes through the three vertices of the triangle.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      circumcircle : Circle\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.ellipse.Circle\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.circumcircle\n",
      " |      Circle(Point2D(1/2, 1/2), sqrt(2)/2)\n",
      " |  \n",
      " |  circumradius\n",
      " |      The radius of the circumcircle of the triangle.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      circumradius : number of Basic instance\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.ellipse.Circle.radius\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> a = Symbol('a')\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, a)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.circumradius\n",
      " |      sqrt(a**2/4 + 1/4)\n",
      " |  \n",
      " |  eulerline\n",
      " |      The Euler line of the triangle.\n",
      " |      \n",
      " |      The line which passes through circumcenter, centroid and orthocenter.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      eulerline : Line (or Point for equilateral triangles in which case all\n",
      " |                  centers coincide)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.eulerline\n",
      " |      Line2D(Point2D(0, 0), Point2D(1/2, 1/2))\n",
      " |  \n",
      " |  excenters\n",
      " |      Excenters of the triangle.\n",
      " |      \n",
      " |      An excenter is the center of a circle that is tangent to a side of the\n",
      " |      triangle and the extensions of the other two sides.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      excenters : dict\n",
      " |      \n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      The excenters are keyed to the side of the triangle to which their corresponding\n",
      " |      excircle is tangent: The center is keyed, e.g. the excenter of a circle touching\n",
      " |      side 0 is:\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(6, 0), Point(0, 2)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.excenters[t.sides[0]]\n",
      " |      Point2D(12*sqrt(10), 2/3 + sqrt(10)/3)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.polygon.Triangle.exradii\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://mathworld.wolfram.com/Excircles.html\n",
      " |  \n",
      " |  exradii\n",
      " |      The radius of excircles of a triangle.\n",
      " |      \n",
      " |      An excircle of the triangle is a circle lying outside the triangle,\n",
      " |      tangent to one of its sides and tangent to the extensions of the\n",
      " |      other two.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      exradii : dict\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.polygon.Triangle.inradius\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      The exradius touches the side of the triangle to which it is keyed, e.g.\n",
      " |      the exradius touching side 2 is:\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(6, 0), Point(0, 2)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.exradii[t.sides[2]]\n",
      " |      -2 + sqrt(10)\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://mathworld.wolfram.com/Exradius.html\n",
      " |      .. [2] https://mathworld.wolfram.com/Excircles.html\n",
      " |  \n",
      " |  incenter\n",
      " |      The center of the incircle.\n",
      " |      \n",
      " |      The incircle is the circle which lies inside the triangle and touches\n",
      " |      all three sides.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      incenter : Point\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      incircle, sympy.geometry.point.Point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.incenter\n",
      " |      Point2D(1 - sqrt(2)/2, 1 - sqrt(2)/2)\n",
      " |  \n",
      " |  incircle\n",
      " |      The incircle of the triangle.\n",
      " |      \n",
      " |      The incircle is the circle which lies inside the triangle and touches\n",
      " |      all three sides.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      incircle : Circle\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.ellipse.Circle\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(2, 0), Point(0, 2)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.incircle\n",
      " |      Circle(Point2D(2 - sqrt(2), 2 - sqrt(2)), 2 - sqrt(2))\n",
      " |  \n",
      " |  inradius\n",
      " |      The radius of the incircle.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      inradius : number of Basic instance\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      incircle, sympy.geometry.ellipse.Circle.radius\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(4, 0), Point(0, 3)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.inradius\n",
      " |      1\n",
      " |  \n",
      " |  medial\n",
      " |      The medial triangle of the triangle.\n",
      " |      \n",
      " |      The triangle which is formed from the midpoints of the three sides.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      medial : Triangle\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.line.Segment.midpoint\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.medial\n",
      " |      Triangle(Point2D(1/2, 0), Point2D(1/2, 1/2), Point2D(0, 1/2))\n",
      " |  \n",
      " |  medians\n",
      " |      The medians of the triangle.\n",
      " |      \n",
      " |      A median of a triangle is a straight line through a vertex and the\n",
      " |      midpoint of the opposite side, and divides the triangle into two\n",
      " |      equal areas.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      medians : dict\n",
      " |          Each key is a vertex (Point) and each value is the median (Segment)\n",
      " |          at that point.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point.midpoint, sympy.geometry.line.Segment.midpoint\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.medians[p1]\n",
      " |      Segment2D(Point2D(0, 0), Point2D(1/2, 1/2))\n",
      " |  \n",
      " |  nine_point_circle\n",
      " |      The nine-point circle of the triangle.\n",
      " |      \n",
      " |      Nine-point circle is the circumcircle of the medial triangle, which\n",
      " |      passes through the feet of altitudes and the middle points of segments\n",
      " |      connecting the vertices and the orthocenter.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      nine_point_circle : Circle\n",
      " |      \n",
      " |      See also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.line.Segment.midpoint\n",
      " |      sympy.geometry.polygon.Triangle.medial\n",
      " |      sympy.geometry.polygon.Triangle.orthocenter\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.nine_point_circle\n",
      " |      Circle(Point2D(1/4, 1/4), sqrt(2)/4)\n",
      " |  \n",
      " |  orthocenter\n",
      " |      The orthocenter of the triangle.\n",
      " |      \n",
      " |      The orthocenter is the intersection of the altitudes of a triangle.\n",
      " |      It may lie inside, outside or on the triangle.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      orthocenter : Point\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Triangle\n",
      " |      >>> p1, p2, p3 = Point(0, 0), Point(1, 0), Point(0, 1)\n",
      " |      >>> t = Triangle(p1, p2, p3)\n",
      " |      >>> t.orthocenter\n",
      " |      Point2D(0, 0)\n",
      " |  \n",
      " |  vertices\n",
      " |      The triangle's vertices\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      vertices : tuple\n",
      " |          Each element in the tuple is a Point\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Triangle, Point\n",
      " |      >>> t = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))\n",
      " |      >>> t.vertices\n",
      " |      (Point2D(0, 0), Point2D(4, 0), Point2D(4, 3))\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  default_assumptions = {}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from Polygon:\n",
      " |  \n",
      " |  __contains__(self, o)\n",
      " |      Return True if o is contained within the boundary lines of self.altitudes\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      other : GeometryEntity\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      contained in : bool\n",
      " |          The points (and sides, if applicable) are contained in self.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.entity.GeometryEntity.encloses\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Line, Segment, Point\n",
      " |      >>> p = Point(0, 0)\n",
      " |      >>> q = Point(1, 1)\n",
      " |      >>> s = Segment(p, q*2)\n",
      " |      >>> l = Line(p, q)\n",
      " |      >>> p in q\n",
      " |      False\n",
      " |      >>> p in s\n",
      " |      True\n",
      " |      >>> q*3 in s\n",
      " |      False\n",
      " |      >>> s in l\n",
      " |      True\n",
      " |  \n",
      " |  arbitrary_point(self, parameter='t')\n",
      " |      A parameterized point on the polygon.\n",
      " |      \n",
      " |      The parameter, varying from 0 to 1, assigns points to the position on\n",
      " |      the perimeter that is that fraction of the total perimeter. So the\n",
      " |      point evaluated at t=1/2 would return the point from the first vertex\n",
      " |      that is 1/2 way around the polygon.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      parameter : str, optional\n",
      " |          Default value is 't'.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      arbitrary_point : Point\n",
      " |      \n",
      " |      Raises\n",
      " |      ======\n",
      " |      \n",
      " |      ValueError\n",
      " |          When `parameter` already appears in the Polygon's definition.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon, Symbol\n",
      " |      >>> t = Symbol('t', real=True)\n",
      " |      >>> tri = Polygon((0, 0), (1, 0), (1, 1))\n",
      " |      >>> p = tri.arbitrary_point('t')\n",
      " |      >>> perimeter = tri.perimeter\n",
      " |      >>> s1, s2 = [s.length for s in tri.sides[:2]]\n",
      " |      >>> p.subs(t, (s1 + s2/2)/perimeter)\n",
      " |      Point2D(1, 1/2)\n",
      " |  \n",
      " |  cut_section(self, line)\n",
      " |      Returns a tuple of two polygon segments that lie above and below\n",
      " |      the intersecting line respectively.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      line: Line object of geometry module\n",
      " |          line which cuts the Polygon. The part of the Polygon that lies\n",
      " |          above and below this line is returned.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      upper_polygon, lower_polygon: Polygon objects or None\n",
      " |          upper_polygon is the polygon that lies above the given line.\n",
      " |          lower_polygon is the polygon that lies below the given line.\n",
      " |          upper_polygon and lower polygon are ``None`` when no polygon\n",
      " |          exists above the line or below the line.\n",
      " |      \n",
      " |      Raises\n",
      " |      ======\n",
      " |      \n",
      " |      ValueError: When the line does not intersect the polygon\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon, Line\n",
      " |      >>> a, b = 20, 10\n",
      " |      >>> p1, p2, p3, p4 = [(0, b), (0, 0), (a, 0), (a, b)]\n",
      " |      >>> rectangle = Polygon(p1, p2, p3, p4)\n",
      " |      >>> t = rectangle.cut_section(Line((0, 5), slope=0))\n",
      " |      >>> t\n",
      " |      (Polygon(Point2D(0, 10), Point2D(0, 5), Point2D(20, 5), Point2D(20, 10)),\n",
      " |      Polygon(Point2D(0, 5), Point2D(0, 0), Point2D(20, 0), Point2D(20, 5)))\n",
      " |      >>> upper_segment, lower_segment = t\n",
      " |      >>> upper_segment.area\n",
      " |      100\n",
      " |      >>> upper_segment.centroid\n",
      " |      Point2D(10, 15/2)\n",
      " |      >>> lower_segment.centroid\n",
      " |      Point2D(10, 5/2)\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://github.com/sympy/sympy/wiki/A-method-to-return-a-cut-section-of-any-polygon-geometry\n",
      " |  \n",
      " |  distance(self, o)\n",
      " |      Returns the shortest distance between self and o.\n",
      " |      \n",
      " |      If o is a point, then self does not need to be convex.\n",
      " |      If o is another polygon self and o must be convex.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon, RegularPolygon\n",
      " |      >>> p1, p2 = map(Point, [(0, 0), (7, 5)])\n",
      " |      >>> poly = Polygon(*RegularPolygon(p1, 1, 3).vertices)\n",
      " |      >>> poly.distance(p2)\n",
      " |      sqrt(61)\n",
      " |  \n",
      " |  encloses_point(self, p)\n",
      " |      Return True if p is enclosed by (is inside of) self.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Being on the border of self is considered False.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      p : Point\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      encloses_point : True, False or None\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.ellipse.Ellipse.encloses_point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon, Point\n",
      " |      >>> p = Polygon((0, 0), (4, 0), (4, 4))\n",
      " |      >>> p.encloses_point(Point(2, 1))\n",
      " |      True\n",
      " |      >>> p.encloses_point(Point(2, 2))\n",
      " |      False\n",
      " |      >>> p.encloses_point(Point(5, 5))\n",
      " |      False\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] http://paulbourke.net/geometry/polygonmesh/#insidepoly\n",
      " |  \n",
      " |  first_moment_of_area(self, point=None)\n",
      " |      Returns the first moment of area of a two-dimensional polygon with\n",
      " |      respect to a certain point of interest.\n",
      " |      \n",
      " |      First moment of area is a measure of the distribution of the area\n",
      " |      of a polygon in relation to an axis. The first moment of area of\n",
      " |      the entire polygon about its own centroid is always zero. Therefore,\n",
      " |      here it is calculated for an area, above or below a certain point\n",
      " |      of interest, that makes up a smaller portion of the polygon. This\n",
      " |      area is bounded by the point of interest and the extreme end\n",
      " |      (top or bottom) of the polygon. The first moment for this area is\n",
      " |      is then determined about the centroidal axis of the initial polygon.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://skyciv.com/docs/tutorials/section-tutorials/calculating-the-statical-or-first-moment-of-area-of-beam-sections/?cc=BMD\n",
      " |      .. [2] https://mechanicalc.com/reference/cross-sections\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      point: Point, two-tuple of sympifyable objects, or None (default=None)\n",
      " |          point is the point above or below which the area of interest lies\n",
      " |          If ``point=None`` then the centroid acts as the point of interest.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      Q_x, Q_y: number or SymPy expressions\n",
      " |          Q_x is the first moment of area about the x-axis\n",
      " |          Q_y is the first moment of area about the y-axis\n",
      " |          A negative sign indicates that the section modulus is\n",
      " |          determined for a section below (or left of) the centroidal axis\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> a, b = 50, 10\n",
      " |      >>> p1, p2, p3, p4 = [(0, b), (0, 0), (a, 0), (a, b)]\n",
      " |      >>> p = Polygon(p1, p2, p3, p4)\n",
      " |      >>> p.first_moment_of_area()\n",
      " |      (625, 3125)\n",
      " |      >>> p.first_moment_of_area(point=Point(30, 7))\n",
      " |      (525, 3000)\n",
      " |  \n",
      " |  intersection(self, o)\n",
      " |      The intersection of polygon and geometry entity.\n",
      " |      \n",
      " |      The intersection may be empty and can contain individual Points and\n",
      " |      complete Line Segments.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      other: GeometryEntity\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      intersection : list\n",
      " |          The list of Segments and Points\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.line.Segment\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon, Line\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly1 = Polygon(p1, p2, p3, p4)\n",
      " |      >>> p5, p6, p7 = map(Point, [(3, 2), (1, -1), (0, 2)])\n",
      " |      >>> poly2 = Polygon(p5, p6, p7)\n",
      " |      >>> poly1.intersection(poly2)\n",
      " |      [Point2D(1/3, 1), Point2D(2/3, 0), Point2D(9/5, 1/5), Point2D(7/3, 1)]\n",
      " |      >>> poly1.intersection(Line(p1, p2))\n",
      " |      [Segment2D(Point2D(0, 0), Point2D(1, 0))]\n",
      " |      >>> poly1.intersection(p1)\n",
      " |      [Point2D(0, 0)]\n",
      " |  \n",
      " |  is_convex(self)\n",
      " |      Is the polygon convex?\n",
      " |      \n",
      " |      A polygon is convex if all its interior angles are less than 180\n",
      " |      degrees and there are no intersections between sides.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      is_convex : boolean\n",
      " |          True if this polygon is convex, False otherwise.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.util.convex_hull\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.is_convex()\n",
      " |      True\n",
      " |  \n",
      " |  parameter_value(self, other, t)\n",
      " |      Return the parameter corresponding to the given point.\n",
      " |      Evaluating an arbitrary point of the entity at this parameter\n",
      " |      value will return the given point.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Line, Point\n",
      " |      >>> from sympy.abc import t\n",
      " |      >>> a = Point(0, 0)\n",
      " |      >>> b = Point(2, 2)\n",
      " |      >>> Line(a, b).parameter_value((1, 1), t)\n",
      " |      {t: 1/2}\n",
      " |      >>> Line(a, b).arbitrary_point(t).subs(_)\n",
      " |      Point2D(1, 1)\n",
      " |  \n",
      " |  plot_interval(self, parameter='t')\n",
      " |      The plot interval for the default geometric plot of the polygon.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      parameter : str, optional\n",
      " |          Default value is 't'.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      plot_interval : list (plot interval)\n",
      " |          [parameter, lower_bound, upper_bound]\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon\n",
      " |      >>> p = Polygon((0, 0), (1, 0), (1, 1))\n",
      " |      >>> p.plot_interval()\n",
      " |      [t, 0, 1]\n",
      " |  \n",
      " |  polar_second_moment_of_area(self)\n",
      " |      Returns the polar modulus of a two-dimensional polygon\n",
      " |      \n",
      " |      It is a constituent of the second moment of area, linked through\n",
      " |      the perpendicular axis theorem. While the planar second moment of\n",
      " |      area describes an object's resistance to deflection (bending) when\n",
      " |      subjected to a force applied to a plane parallel to the central\n",
      " |      axis, the polar second moment of area describes an object's\n",
      " |      resistance to deflection when subjected to a moment applied in a\n",
      " |      plane perpendicular to the object's central axis (i.e. parallel to\n",
      " |      the cross-section)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon, symbols\n",
      " |      >>> a, b = symbols('a, b')\n",
      " |      >>> rectangle = Polygon((0, 0), (a, 0), (a, b), (0, b))\n",
      " |      >>> rectangle.polar_second_moment_of_area()\n",
      " |      a**3*b/12 + a*b**3/12\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Polar_moment_of_inertia\n",
      " |  \n",
      " |  second_moment_of_area(self, point=None)\n",
      " |      Returns the second moment and product moment of area of a two dimensional polygon.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      point : Point, two-tuple of sympifyable objects, or None(default=None)\n",
      " |          point is the point about which second moment of area is to be found.\n",
      " |          If \"point=None\" it will be calculated about the axis passing through the\n",
      " |          centroid of the polygon.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      I_xx, I_yy, I_xy : number or SymPy expression\n",
      " |                         I_xx, I_yy are second moment of area of a two dimensional polygon.\n",
      " |                         I_xy is product moment of area of a two dimensional polygon.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Polygon, symbols\n",
      " |      >>> a, b = symbols('a, b')\n",
      " |      >>> p1, p2, p3, p4, p5 = [(0, 0), (a, 0), (a, b), (0, b), (a/3, b/3)]\n",
      " |      >>> rectangle = Polygon(p1, p2, p3, p4)\n",
      " |      >>> rectangle.second_moment_of_area()\n",
      " |      (a*b**3/12, a**3*b/12, 0)\n",
      " |      >>> rectangle.second_moment_of_area(p5)\n",
      " |      (a*b**3/9, a**3*b/9, a**2*b**2/36)\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Second_moment_of_area\n",
      " |  \n",
      " |  section_modulus(self, point=None)\n",
      " |      Returns a tuple with the section modulus of a two-dimensional\n",
      " |      polygon.\n",
      " |      \n",
      " |      Section modulus is a geometric property of a polygon defined as the\n",
      " |      ratio of second moment of area to the distance of the extreme end of\n",
      " |      the polygon from the centroidal axis.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      point : Point, two-tuple of sympifyable objects, or None(default=None)\n",
      " |          point is the point at which section modulus is to be found.\n",
      " |          If \"point=None\" it will be calculated for the point farthest from the\n",
      " |          centroidal axis of the polygon.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      S_x, S_y: numbers or SymPy expressions\n",
      " |                S_x is the section modulus with respect to the x-axis\n",
      " |                S_y is the section modulus with respect to the y-axis\n",
      " |                A negative sign indicates that the section modulus is\n",
      " |                determined for a point below the centroidal axis\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Polygon, Point\n",
      " |      >>> a, b = symbols('a, b', positive=True)\n",
      " |      >>> rectangle = Polygon((0, 0), (a, 0), (a, b), (0, b))\n",
      " |      >>> rectangle.section_modulus()\n",
      " |      (a*b**2/6, a**2*b/6)\n",
      " |      >>> rectangle.section_modulus(Point(a/4, b/4))\n",
      " |      (-a*b**2/3, -a**2*b/3)\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Section_modulus\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from Polygon:\n",
      " |  \n",
      " |  ambient_dimension\n",
      " |      What is the dimension of the space that the object is contained in?\n",
      " |  \n",
      " |  angles\n",
      " |      The internal angle at each vertex.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      angles : dict\n",
      " |          A dictionary where each key is a vertex and each value is the\n",
      " |          internal angle at that vertex. The vertices are represented as\n",
      " |          Points.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.line.LinearEntity.angle_between\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.angles[p1]\n",
      " |      pi/2\n",
      " |      >>> poly.angles[p2]\n",
      " |      acos(-4*sqrt(17)/17)\n",
      " |  \n",
      " |  area\n",
      " |      The area of the polygon.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      The area calculation can be positive or negative based on the\n",
      " |      orientation of the points. If any side of the polygon crosses\n",
      " |      any other side, there will be areas having opposite signs.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.ellipse.Ellipse.area\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.area\n",
      " |      3\n",
      " |      \n",
      " |      In the Z shaped polygon (with the lower right connecting back\n",
      " |      to the upper left) the areas cancel out:\n",
      " |      \n",
      " |      >>> Z = Polygon((0, 1), (1, 1), (0, 0), (1, 0))\n",
      " |      >>> Z.area\n",
      " |      0\n",
      " |      \n",
      " |      In the M shaped polygon, areas do not cancel because no side\n",
      " |      crosses any other (though there is a point of contact).\n",
      " |      \n",
      " |      >>> M = Polygon((0, 0), (0, 1), (2, 0), (3, 1), (3, 0))\n",
      " |      >>> M.area\n",
      " |      -3/2\n",
      " |  \n",
      " |  bounds\n",
      " |      Return a tuple (xmin, ymin, xmax, ymax) representing the bounding\n",
      " |      rectangle for the geometric figure.\n",
      " |  \n",
      " |  centroid\n",
      " |      The centroid of the polygon.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      centroid : Point\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.util.centroid\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.centroid\n",
      " |      Point2D(31/18, 11/18)\n",
      " |  \n",
      " |  perimeter\n",
      " |      The perimeter of the polygon.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      perimeter : number or Basic instance\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.line.Segment.length\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.perimeter\n",
      " |      sqrt(17) + 7\n",
      " |  \n",
      " |  sides\n",
      " |      The directed line segments that form the sides of the polygon.\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      sides : list of sides\n",
      " |          Each side is a directed Segment.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.point.Point, sympy.geometry.line.Segment\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, Polygon\n",
      " |      >>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])\n",
      " |      >>> poly = Polygon(p1, p2, p3, p4)\n",
      " |      >>> poly.sides\n",
      " |      [Segment2D(Point2D(0, 0), Point2D(1, 0)),\n",
      " |      Segment2D(Point2D(1, 0), Point2D(5, 1)),\n",
      " |      Segment2D(Point2D(5, 1), Point2D(0, 1)), Segment2D(Point2D(0, 1), Point2D(0, 0))]\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.geometry.entity.GeometryEntity:\n",
      " |  \n",
      " |  __cmp__(self, other)\n",
      " |      Comparison of two GeometryEntities.\n",
      " |  \n",
      " |  __getnewargs__(self)\n",
      " |      Returns a tuple that will be passed to __new__ on unpickling.\n",
      " |  \n",
      " |  __ne__(self, o)\n",
      " |      Test inequality of two geometrical entities.\n",
      " |  \n",
      " |  __radd__(self, a)\n",
      " |      Implementation of reverse add method.\n",
      " |  \n",
      " |  __repr__(self)\n",
      " |      String representation of a GeometryEntity that can be evaluated\n",
      " |      by sympy.\n",
      " |  \n",
      " |  __rmul__(self, a)\n",
      " |      Implementation of reverse multiplication method.\n",
      " |  \n",
      " |  __rsub__(self, a)\n",
      " |      Implementation of reverse subtraction method.\n",
      " |  \n",
      " |  __rtruediv__(self, a)\n",
      " |      Implementation of reverse division method.\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      String representation of a GeometryEntity.\n",
      " |  \n",
      " |  encloses(self, o)\n",
      " |      Return True if o is inside (not on or outside) the boundaries of self.\n",
      " |      \n",
      " |      The object will be decomposed into Points and individual Entities need\n",
      " |      only define an encloses_point method for their class.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.geometry.ellipse.Ellipse.encloses_point\n",
      " |      sympy.geometry.polygon.Polygon.encloses_point\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import RegularPolygon, Point, Polygon\n",
      " |      >>> t  = Polygon(*RegularPolygon(Point(0, 0), 1, 3).vertices)\n",
      " |      >>> t2 = Polygon(*RegularPolygon(Point(0, 0), 2, 3).vertices)\n",
      " |      >>> t2.encloses(t)\n",
      " |      True\n",
      " |      >>> t.encloses(t2)\n",
      " |      False\n",
      " |  \n",
      " |  equals(self, o)\n",
      " |  \n",
      " |  reflect(self, line)\n",
      " |      Reflects an object across a line.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      line: Line\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, sqrt, Line, RegularPolygon\n",
      " |      >>> l = Line((0, pi), slope=sqrt(2))\n",
      " |      >>> pent = RegularPolygon((1, 2), 1, 5)\n",
      " |      >>> rpent = pent.reflect(l)\n",
      " |      >>> rpent\n",
      " |      RegularPolygon(Point2D(-2*sqrt(2)*pi/3 - 1/3 + 4*sqrt(2)/3, 2/3 + 2*sqrt(2)/3 + 2*pi/3), -1, 5, -atan(2*sqrt(2)) + 3*pi/5)\n",
      " |      \n",
      " |      >>> from sympy import pi, Line, Circle, Point\n",
      " |      >>> l = Line((0, pi), slope=1)\n",
      " |      >>> circ = Circle(Point(0, 0), 5)\n",
      " |      >>> rcirc = circ.reflect(l)\n",
      " |      >>> rcirc\n",
      " |      Circle(Point2D(-pi, pi), -5)\n",
      " |  \n",
      " |  rotate(self, angle, pt=None)\n",
      " |      Rotate ``angle`` radians counterclockwise about Point ``pt``.\n",
      " |      \n",
      " |      The default pt is the origin, Point(0, 0)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      scale, translate\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Point, RegularPolygon, Polygon, pi\n",
      " |      >>> t = Polygon(*RegularPolygon(Point(0, 0), 1, 3).vertices)\n",
      " |      >>> t # vertex on x axis\n",
      " |      Triangle(Point2D(1, 0), Point2D(-1/2, sqrt(3)/2), Point2D(-1/2, -sqrt(3)/2))\n",
      " |      >>> t.rotate(pi/2) # vertex on y axis now\n",
      " |      Triangle(Point2D(0, 1), Point2D(-sqrt(3)/2, -1/2), Point2D(sqrt(3)/2, -1/2))\n",
      " |  \n",
      " |  scale(self, x=1, y=1, pt=None)\n",
      " |      Scale the object by multiplying the x,y-coordinates by x and y.\n",
      " |      \n",
      " |      If pt is given, the scaling is done relative to that point; the\n",
      " |      object is shifted by -pt, scaled, and shifted by pt.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      rotate, translate\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import RegularPolygon, Point, Polygon\n",
      " |      >>> t = Polygon(*RegularPolygon(Point(0, 0), 1, 3).vertices)\n",
      " |      >>> t\n",
      " |      Triangle(Point2D(1, 0), Point2D(-1/2, sqrt(3)/2), Point2D(-1/2, -sqrt(3)/2))\n",
      " |      >>> t.scale(2)\n",
      " |      Triangle(Point2D(2, 0), Point2D(-1, sqrt(3)/2), Point2D(-1, -sqrt(3)/2))\n",
      " |      >>> t.scale(2, 2)\n",
      " |      Triangle(Point2D(2, 0), Point2D(-1, sqrt(3)), Point2D(-1, -sqrt(3)))\n",
      " |  \n",
      " |  translate(self, x=0, y=0)\n",
      " |      Shift the object by adding to the x,y-coordinates the values x and y.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      rotate, scale\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import RegularPolygon, Point, Polygon\n",
      " |      >>> t = Polygon(*RegularPolygon(Point(0, 0), 1, 3).vertices)\n",
      " |      >>> t\n",
      " |      Triangle(Point2D(1, 0), Point2D(-1/2, sqrt(3)/2), Point2D(-1/2, -sqrt(3)/2))\n",
      " |      >>> t.translate(2)\n",
      " |      Triangle(Point2D(3, 0), Point2D(3/2, sqrt(3)/2), Point2D(3/2, -sqrt(3)/2))\n",
      " |      >>> t.translate(2, 2)\n",
      " |      Triangle(Point2D(3, 2), Point2D(3/2, sqrt(3)/2 + 2), Point2D(3/2, 2 - sqrt(3)/2))\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.geometry.entity.GeometryEntity:\n",
      " |  \n",
      " |  __annotations__ = {'__slots__': 'tuple[str, ...]'}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  __add__(self, other)\n",
      " |  \n",
      " |  __and__(self, other)\n",
      " |  \n",
      " |  __mul__(self, other)\n",
      " |  \n",
      " |  __or__(self, other)\n",
      " |  \n",
      " |  __pow__(self, exp)\n",
      " |  \n",
      " |  __sub__(self, other)\n",
      " |  \n",
      " |  __xor__(self, other)\n",
      " |  \n",
      " |  complement(self, universe)\n",
      " |      The complement of 'self' w.r.t the given universe.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(0, 1).complement(S.Reals)\n",
      " |      Union(Interval.open(-oo, 0), Interval.open(1, oo))\n",
      " |      \n",
      " |      >>> Interval(0, 1).complement(S.UniversalSet)\n",
      " |      Complement(UniversalSet, Interval(0, 1))\n",
      " |  \n",
      " |  contains(self, other)\n",
      " |      Returns a SymPy value indicating whether ``other`` is contained\n",
      " |      in ``self``: ``true`` if it is, ``false`` if it is not, else\n",
      " |      an unevaluated ``Contains`` expression (or, as in the case of\n",
      " |      ConditionSet and a union of FiniteSet/Intervals, an expression\n",
      " |      indicating the conditions for containment).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(0.5)\n",
      " |      True\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``in`` operator, but that\n",
      " |      will raise an error unless an affirmative true or false is not\n",
      " |      obtained.\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(x)\n",
      " |      (0 <= x) & (x <= 1)\n",
      " |      >>> x in Interval(0, 1)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      TypeError: did not evaluate to a bool: None\n",
      " |      \n",
      " |      The result of 'in' is a bool, not a SymPy value\n",
      " |      \n",
      " |      >>> 1 in Interval(0, 2)\n",
      " |      True\n",
      " |      >>> _ is S.true\n",
      " |      False\n",
      " |  \n",
      " |  intersect(self, other)\n",
      " |      Returns the intersection of 'self' and 'other'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      \n",
      " |      >>> Interval(1, 3).intersect(Interval(1, 2))\n",
      " |      Interval(1, 2)\n",
      " |      \n",
      " |      >>> from sympy import imageset, Lambda, symbols, S\n",
      " |      >>> n, m = symbols('n m')\n",
      " |      >>> a = imageset(Lambda(n, 2*n), S.Integers)\n",
      " |      >>> a.intersect(imageset(Lambda(m, 2*m + 1), S.Integers))\n",
      " |      EmptySet\n",
      " |  \n",
      " |  is_disjoint(self, other)\n",
      " |      Returns True if ``self`` and ``other`` are disjoint.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(1, 2))\n",
      " |      False\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(3, 4))\n",
      " |      True\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Disjoint_sets\n",
      " |  \n",
      " |  is_proper_subset(self, other)\n",
      " |      Returns True if ``self`` is a proper subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_proper_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_subset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_proper_superset(self, other)\n",
      " |      Returns True if ``self`` is a proper superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 0.5))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_subset(self, other)\n",
      " |      Returns True if ``self`` is a subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_subset(Interval(0, 1, left_open=True))\n",
      " |      False\n",
      " |  \n",
      " |  is_superset(self, other)\n",
      " |      Returns True if ``self`` is a superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_superset(Interval(0, 1))\n",
      " |      False\n",
      " |      >>> Interval(0, 1).is_superset(Interval(0, 1, left_open=True))\n",
      " |      True\n",
      " |  \n",
      " |  isdisjoint(self, other)\n",
      " |      Alias for :meth:`is_disjoint()`\n",
      " |  \n",
      " |  issubset(self, other)\n",
      " |      Alias for :meth:`is_subset()`\n",
      " |  \n",
      " |  issuperset(self, other)\n",
      " |      Alias for :meth:`is_superset()`\n",
      " |  \n",
      " |  powerset(self)\n",
      " |      Find the Power set of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import EmptySet, FiniteSet, Interval\n",
      " |      \n",
      " |      A power set of an empty set:\n",
      " |      \n",
      " |      >>> A = EmptySet\n",
      " |      >>> A.powerset()\n",
      " |      {EmptySet}\n",
      " |      \n",
      " |      A power set of a finite set:\n",
      " |      \n",
      " |      >>> A = FiniteSet(1, 2)\n",
      " |      >>> a, b, c = FiniteSet(1), FiniteSet(2), FiniteSet(1, 2)\n",
      " |      >>> A.powerset() == FiniteSet(a, b, c, EmptySet)\n",
      " |      True\n",
      " |      \n",
      " |      A power set of an interval:\n",
      " |      \n",
      " |      >>> Interval(1, 2).powerset()\n",
      " |      PowerSet(Interval(1, 2))\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Power_set\n",
      " |  \n",
      " |  symmetric_difference(self, other)\n",
      " |      Returns symmetric difference of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(1, 3).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(3, oo))\n",
      " |      >>> Interval(1, 10).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(10, oo))\n",
      " |      \n",
      " |      >>> from sympy import S, EmptySet\n",
      " |      >>> S.Reals.symmetric_difference(EmptySet)\n",
      " |      Reals\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      .. [1] https://en.wikipedia.org/wiki/Symmetric_difference\n",
      " |  \n",
      " |  union(self, other)\n",
      " |      Returns the union of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``+`` operator:\n",
      " |      \n",
      " |      >>> from sympy import Interval, FiniteSet\n",
      " |      >>> Interval(0, 1).union(Interval(2, 3))\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(0, 1) + Interval(2, 3)\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(1, 2, True, True) + FiniteSet(2, 3)\n",
      " |      Union({3}, Interval.Lopen(1, 2))\n",
      " |      \n",
      " |      Similarly it is possible to use the ``-`` operator for set differences:\n",
      " |      \n",
      " |      >>> Interval(0, 2) - Interval(0, 1)\n",
      " |      Interval.Lopen(1, 2)\n",
      " |      >>> Interval(1, 3) - FiniteSet(2)\n",
      " |      Union(Interval.Ropen(1, 2), Interval.Lopen(2, 3))\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  boundary\n",
      " |      The boundary or frontier of a set.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A point x is on the boundary of a set S if\n",
      " |      \n",
      " |      1.  x is in the closure of S.\n",
      " |          I.e. Every neighborhood of x contains a point in S.\n",
      " |      2.  x is not in the interior of S.\n",
      " |          I.e. There does not exist an open set centered on x contained\n",
      " |          entirely within S.\n",
      " |      \n",
      " |      There are the points on the outer rim of S.  If S is open then these\n",
      " |      points need not actually be contained within S.\n",
      " |      \n",
      " |      For example, the boundary of an interval is its start and end points.\n",
      " |      This is true regardless of whether or not the interval is open.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).boundary\n",
      " |      {0, 1}\n",
      " |      >>> Interval(0, 1, True, False).boundary\n",
      " |      {0, 1}\n",
      " |  \n",
      " |  closure\n",
      " |      Property method which returns the closure of a set.\n",
      " |      The closure is defined as the union of the set itself and its\n",
      " |      boundary.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S, Interval\n",
      " |      >>> S.Reals.closure\n",
      " |      Reals\n",
      " |      >>> Interval(0, 1).closure\n",
      " |      Interval(0, 1)\n",
      " |  \n",
      " |  inf\n",
      " |      The infimum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).inf\n",
      " |      0\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).inf\n",
      " |      0\n",
      " |  \n",
      " |  interior\n",
      " |      Property method which returns the interior of a set.\n",
      " |      The interior of a set S consists all points of S that do not\n",
      " |      belong to the boundary of S.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).interior\n",
      " |      Interval.open(0, 1)\n",
      " |      >>> Interval(0, 1).boundary.interior\n",
      " |      EmptySet\n",
      " |  \n",
      " |  is_EmptySet\n",
      " |  \n",
      " |  is_closed\n",
      " |      A property method to check whether a set is closed.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is closed if its complement is an open set. The closedness of a\n",
      " |      subset of the reals is determined with respect to R and its standard\n",
      " |      topology.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_closed\n",
      " |      True\n",
      " |  \n",
      " |  is_open\n",
      " |      Property method to check whether a set is open.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is open if and only if it has an empty intersection with its\n",
      " |      boundary. In particular, a subset A of the reals is open if and only\n",
      " |      if each one of its points is contained in an open interval that is a\n",
      " |      subset of A.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S\n",
      " |      >>> S.Reals.is_open\n",
      " |      True\n",
      " |      >>> S.Rationals.is_open\n",
      " |      False\n",
      " |  \n",
      " |  kind\n",
      " |      The kind of a Set\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      Any :class:`Set` will have kind :class:`SetKind` which is\n",
      " |      parametrised by the kind of the elements of the set. For example\n",
      " |      most sets are sets of numbers and will have kind\n",
      " |      ``SetKind(NumberKind)``. If elements of sets are different in kind than\n",
      " |      their kind will ``SetKind(UndefinedKind)``. See\n",
      " |      :class:`sympy.core.kind.Kind` for an explanation of the kind system.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Matrix, FiniteSet, EmptySet, ProductSet, PowerSet\n",
      " |      \n",
      " |      >>> FiniteSet(Matrix([1, 2])).kind\n",
      " |      SetKind(MatrixKind(NumberKind))\n",
      " |      \n",
      " |      >>> Interval(1, 2).kind\n",
      " |      SetKind(NumberKind)\n",
      " |      \n",
      " |      >>> EmptySet.kind\n",
      " |      SetKind()\n",
      " |      \n",
      " |      A :class:`sympy.sets.powerset.PowerSet` is a set of sets:\n",
      " |      \n",
      " |      >>> PowerSet({1, 2, 3}).kind\n",
      " |      SetKind(SetKind(NumberKind))\n",
      " |      \n",
      " |      A :class:`ProductSet` represents the set of tuples of elements of\n",
      " |      other sets. Its kind is :class:`sympy.core.containers.TupleKind`\n",
      " |      parametrised by the kinds of the elements of those sets:\n",
      " |      \n",
      " |      >>> p = ProductSet(FiniteSet(1, 2), FiniteSet(3, 4))\n",
      " |      >>> list(p)\n",
      " |      [(1, 3), (2, 3), (1, 4), (2, 4)]\n",
      " |      >>> p.kind\n",
      " |      SetKind(TupleKind(NumberKind, NumberKind))\n",
      " |      \n",
      " |      When all elements of the set do not have same kind, the kind\n",
      " |      will be returned as ``SetKind(UndefinedKind)``:\n",
      " |      \n",
      " |      >>> FiniteSet(0, Matrix([1, 2])).kind\n",
      " |      SetKind(UndefinedKind)\n",
      " |      \n",
      " |      The kind of the elements of a set are given by the ``element_kind``\n",
      " |      attribute of ``SetKind``:\n",
      " |      \n",
      " |      >>> Interval(1, 2).kind.element_kind\n",
      " |      NumberKind\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      NumberKind\n",
      " |      sympy.core.kind.UndefinedKind\n",
      " |      sympy.core.containers.TupleKind\n",
      " |      MatrixKind\n",
      " |      sympy.matrices.expressions.sets.MatrixSet\n",
      " |      sympy.sets.conditionset.ConditionSet\n",
      " |      Rationals\n",
      " |      Naturals\n",
      " |      Integers\n",
      " |      sympy.sets.fancysets.ImageSet\n",
      " |      sympy.sets.fancysets.Range\n",
      " |      sympy.sets.fancysets.ComplexRegion\n",
      " |      sympy.sets.powerset.PowerSet\n",
      " |      sympy.sets.sets.ProductSet\n",
      " |      sympy.sets.sets.Interval\n",
      " |      sympy.sets.sets.Union\n",
      " |      sympy.sets.sets.Intersection\n",
      " |      sympy.sets.sets.Complement\n",
      " |      sympy.sets.sets.EmptySet\n",
      " |      sympy.sets.sets.UniversalSet\n",
      " |      sympy.sets.sets.FiniteSet\n",
      " |      sympy.sets.sets.SymmetricDifference\n",
      " |      sympy.sets.sets.DisjointUnion\n",
      " |  \n",
      " |  measure\n",
      " |      The (Lebesgue) measure of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).measure\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).measure\n",
      " |      2\n",
      " |  \n",
      " |  sup\n",
      " |      The supremum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).sup\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).sup\n",
      " |      3\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  is_Complement = None\n",
      " |  \n",
      " |  is_ComplexRegion = False\n",
      " |  \n",
      " |  is_FiniteSet = False\n",
      " |  \n",
      " |  is_Intersection = None\n",
      " |  \n",
      " |  is_Interval = False\n",
      " |  \n",
      " |  is_ProductSet = False\n",
      " |  \n",
      " |  is_Union = False\n",
      " |  \n",
      " |  is_UniversalSet = None\n",
      " |  \n",
      " |  is_empty = None\n",
      " |  \n",
      " |  is_finite_set = None\n",
      " |  \n",
      " |  is_interval = False\n",
      " |  \n",
      " |  is_iterable = False\n",
      " |  \n",
      " |  is_number = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |      \n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      from https://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __hash__(self) -> 'int'\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      A stub to allow Basic args (like Tuple) to be skipped when computing\n",
      " |      the content and primitive components of an expression.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.core.expr.Expr.as_content_primitive\n",
      " |  \n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |  \n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |      \n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |      \n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |      \n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |      \n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |      \n",
      " |      The type can be given implicitly, too:\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |      \n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |      \n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |  \n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |      \n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |  \n",
      " |  copy(self)\n",
      " |  \n",
      " |  could_extract_minus_sign(self)\n",
      " |  \n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |  \n",
      " |  count_ops(self, visual=None)\n",
      " |      Wrapper for count_ops that returns the operation count.\n",
      " |  \n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |  \n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> u = Dummy('u')\n",
      " |      \n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |      \n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |  \n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |  \n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |      \n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |      \n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |      \n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |      \n",
      " |      \n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |      \n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |  \n",
      " |  has_free(self, *patterns)\n",
      " |      Return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |      \n",
      " |      This works for subexpressions and types, too:\n",
      " |      \n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |  \n",
      " |  has_xfree(self, s: 'set[Basic]')\n",
      " |      Return True if self has any of the patterns in s as a\n",
      " |      free argument, else False. This is like `Basic.has_free`\n",
      " |      but this will only report exact argument matches.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> f(x).has_xfree({f})\n",
      " |      False\n",
      " |      >>> f(x).has_xfree({f(x)})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x + 1})\n",
      " |      True\n",
      " |      >>> f(x + y + 1).has_xfree({x + 1})\n",
      " |      False\n",
      " |  \n",
      " |  is_hypergeometric(self, k)\n",
      " |  \n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |      \n",
      " |      Wild symbols match all.\n",
      " |      \n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |      \n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |      \n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |      \n",
      " |      But they can be identified if desired:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |      \n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |      \n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |  \n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |  \n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |      \n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |      \n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |      \n",
      " |      however, you can use:\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |  \n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |  \n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |      \n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself does not match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |      \n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |      \n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |      \n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      Initial setup\n",
      " |      \n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |      \n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |      \n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |      \n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |      \n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |      \n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |      \n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |      \n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |      \n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |      \n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |      \n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |      \n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |      \n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |      \n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |      \n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |      \n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |      \n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |      \n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |      \n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |      \n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |      \n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |      \n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |      \n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |      \n",
      " |      Here, we want `exact=False`:\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |      \n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |      \n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |      \n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |      \n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |  \n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |      \n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |      \n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      args : Expr\n",
      " |          A *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |      \n",
      " |      deep : bool, optional\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |      \n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |      \n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |      \n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |      \n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |  \n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |  \n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import S, I\n",
      " |      \n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |      \n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |  \n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |      \n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |      \n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |      \n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |      \n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |      \n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |      \n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |      \n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |      \n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |      \n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |      \n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |      \n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |      \n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |      \n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |      \n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |      \n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |      \n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |      \n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |      \n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |      \n",
      " |      rather than\n",
      " |      \n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |      \n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |  \n",
      " |  xreplace(self, rule)\n",
      " |      Replace occurrences of objects within the expression.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      rule : dict-like\n",
      " |          Expresses a replacement rule\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      xreplace : the result of the replacement\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, pi, exp\n",
      " |      >>> x, y, z = symbols('x y z')\n",
      " |      >>> (1 + x*y).xreplace({x: pi})\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).xreplace({x: pi, y: 2})\n",
      " |      1 + 2*pi\n",
      " |      \n",
      " |      Replacements occur only if an entire node in the expression tree is\n",
      " |      matched:\n",
      " |      \n",
      " |      >>> (x*y + z).xreplace({x*y: pi})\n",
      " |      z + pi\n",
      " |      >>> (x*y*z).xreplace({x*y: pi})\n",
      " |      x*y*z\n",
      " |      >>> (2*x).xreplace({2*x: y, x: z})\n",
      " |      y\n",
      " |      >>> (2*2*x).xreplace({2*x: y, x: z})\n",
      " |      4*z\n",
      " |      >>> (x + y + 2).xreplace({x + y: 2})\n",
      " |      x + y + 2\n",
      " |      >>> (x + 2 + exp(x + 2)).xreplace({x + 2: y})\n",
      " |      x + exp(y) + 2\n",
      " |      \n",
      " |      xreplace does not differentiate between free and bound symbols. In the\n",
      " |      following, subs(x, y) would not change x since it is a bound symbol,\n",
      " |      but xreplace does:\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: y})\n",
      " |      Integral(y, (y, 1, 2*y))\n",
      " |      \n",
      " |      Trying to replace x with an expression raises an error:\n",
      " |      \n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: 2*y}) # doctest: +SKIP\n",
      " |      ValueError: Invalid limits given: ((2*y, 1, 4*y),)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __init_subclass__() from builtins.type\n",
      " |      This method is called when a class is subclassed.\n",
      " |      \n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |  \n",
      " |  class_key() from builtins.type\n",
      " |      Nice order of classes.\n",
      " |  \n",
      " |  fromiter(args, **assumptions) from builtins.type\n",
      " |      Create a new object from an iterable.\n",
      " |      \n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __sympy__\n",
      " |  \n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |      \n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |      \n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Do not override .args() from Basic (so that it is easy to\n",
      " |      change the interface in the future if needed).\n",
      " |  \n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |      \n",
      " |      For example:\n",
      " |      \n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |      \n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |  \n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |  \n",
      " |  expr_free_symbols\n",
      " |  \n",
      " |  free_symbols\n",
      " |      Return from the atoms of self those which are free symbols.\n",
      " |      \n",
      " |      Not all free symbols are ``Symbol``. Eg: IndexedBase('I')[0].free_symbols\n",
      " |      \n",
      " |      For most expressions, all symbols are free symbols. For some classes\n",
      " |      this is not true. e.g. Integrals use Symbols for the dummy variables\n",
      " |      which are bound variables, so Integral has a method to return all\n",
      " |      symbols except those. Derivative keeps track of symbols with respect\n",
      " |      to which it will perform a derivative; those are\n",
      " |      bound variables, too, so it has its own free_symbols method.\n",
      " |      \n",
      " |      Any other method that uses bound variables should implement a\n",
      " |      free_symbols method.\n",
      " |  \n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |      \n",
      " |      The following should hold for all objects::\n",
      " |      \n",
      " |          >> x == x.func(*x.args)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |  \n",
      " |  is_algebraic\n",
      " |  \n",
      " |  is_antihermitian\n",
      " |  \n",
      " |  is_commutative\n",
      " |  \n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |      \n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |  \n",
      " |  is_complex\n",
      " |  \n",
      " |  is_composite\n",
      " |  \n",
      " |  is_even\n",
      " |  \n",
      " |  is_extended_negative\n",
      " |  \n",
      " |  is_extended_nonnegative\n",
      " |  \n",
      " |  is_extended_nonpositive\n",
      " |  \n",
      " |  is_extended_nonzero\n",
      " |  \n",
      " |  is_extended_positive\n",
      " |  \n",
      " |  is_extended_real\n",
      " |  \n",
      " |  is_finite\n",
      " |  \n",
      " |  is_hermitian\n",
      " |  \n",
      " |  is_imaginary\n",
      " |  \n",
      " |  is_infinite\n",
      " |  \n",
      " |  is_integer\n",
      " |  \n",
      " |  is_irrational\n",
      " |  \n",
      " |  is_negative\n",
      " |  \n",
      " |  is_noninteger\n",
      " |  \n",
      " |  is_nonnegative\n",
      " |  \n",
      " |  is_nonpositive\n",
      " |  \n",
      " |  is_nonzero\n",
      " |  \n",
      " |  is_odd\n",
      " |  \n",
      " |  is_polar\n",
      " |  \n",
      " |  is_positive\n",
      " |  \n",
      " |  is_prime\n",
      " |  \n",
      " |  is_rational\n",
      " |  \n",
      " |  is_real\n",
      " |  \n",
      " |  is_transcendental\n",
      " |  \n",
      " |  is_zero\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  is_Add = False\n",
      " |  \n",
      " |  is_AlgebraicNumber = False\n",
      " |  \n",
      " |  is_Atom = False\n",
      " |  \n",
      " |  is_Boolean = False\n",
      " |  \n",
      " |  is_Derivative = False\n",
      " |  \n",
      " |  is_Dummy = False\n",
      " |  \n",
      " |  is_Equality = False\n",
      " |  \n",
      " |  is_Float = False\n",
      " |  \n",
      " |  is_Function = False\n",
      " |  \n",
      " |  is_Indexed = False\n",
      " |  \n",
      " |  is_Integer = False\n",
      " |  \n",
      " |  is_MatAdd = False\n",
      " |  \n",
      " |  is_MatMul = False\n",
      " |  \n",
      " |  is_Matrix = False\n",
      " |  \n",
      " |  is_Mul = False\n",
      " |  \n",
      " |  is_Not = False\n",
      " |  \n",
      " |  is_Number = False\n",
      " |  \n",
      " |  is_NumberSymbol = False\n",
      " |  \n",
      " |  is_Order = False\n",
      " |  \n",
      " |  is_Piecewise = False\n",
      " |  \n",
      " |  is_Point = False\n",
      " |  \n",
      " |  is_Poly = False\n",
      " |  \n",
      " |  is_Pow = False\n",
      " |  \n",
      " |  is_Rational = False\n",
      " |  \n",
      " |  is_Relational = False\n",
      " |  \n",
      " |  is_Symbol = False\n",
      " |  \n",
      " |  is_Vector = False\n",
      " |  \n",
      " |  is_Wild = False\n",
      " |  \n",
      " |  is_symbol = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |  \n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |      \n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |      \n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |      \n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |      \n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |      \n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |      \n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |      \n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |      \n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |      \n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |      \n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |  \n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Triangle)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "c08582e0",
   "metadata": {},
   "outputs": [],
   "source": [
    "t = Triangle(sas=(5,60,7))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "9482871a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{acos}{\\left(\\frac{\\sqrt{39}}{26} \\right)}$"
      ],
      "text/plain": [
       "acos(sqrt(39)/26)"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t.angles[t.vertices[2]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "id": "3ed856ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{39}}{2}$"
      ],
      "text/plain": [
       "sqrt(39)/2"
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(t.sides[1]).length/2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "a8266dc9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 3.1224989991992$"
      ],
      "text/plain": [
       "3.12249899919920"
      ]
     },
     "execution_count": 126,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5afdfd44",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "bd2686bc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{7 \\sqrt{3}}{2}$"
      ],
      "text/plain": [
       "7*sqrt(3)/2"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "((t.sides[1]).length/2)/sin(pi/6)*sin(t.angles[t.vertices[2]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "969d06a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 6.06217782649107$"
      ],
      "text/plain": [
       "6.06217782649107"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(_)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8e85ed14",
   "metadata": {},
   "source": [
    "### 八年级第十四章"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "id": "72a94a76",
   "metadata": {},
   "outputs": [],
   "source": [
    "def stars(a,b):\n",
    "    return a*b+a-b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "f6bc9d5e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle b \\left(b - 1\\right)$"
      ],
      "text/plain": [
       "b*(b - 1)"
      ]
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(stars(a,b)+stars(b-a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "5460eabc",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1322070819480806636890455259752144365965422032752148167664920368226828597346704899540778313850608061963909777696872582355950954582100618911865342725257953674027620225198320803878014774228964841274390400117588618041128947815623094438061566173054086674490506178125480344405547054397038895817465368254916136220830268563778582290228416398307887896918556404084898937609373242171846359938695516765018940588109060426089671438864102814350385648747165832010614366132173102768902855220001"
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "3**1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "3bdaf444",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - a \\left(a^{2} - 2 a - 2\\right) + \\left(a - 2\\right) \\left(a^{2} + 3\\right)$"
      ],
      "text/plain": [
       "-a*(a**2 - 2*a - 2) + (a - 2)*(a**2 + 3)"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(a**2+3)*(a-2)-a*(a**2-2*a-2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "db010e5e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 5 a - 6$"
      ],
      "text/plain": [
       "5*a - 6"
      ]
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "9cafa881",
   "metadata": {},
   "outputs": [],
   "source": [
    "data={x:1,y:S(1)/2}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "d03c9181",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=(3*x+2*y)*(3*x-2*y)-(x-y)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "5ef05ddb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 8 x^{2} + 2 x y   - 5 y  ^{2}$"
      ],
      "text/plain": [
       "8*x**2 + 2*x*y   - 5*y  **2"
      ]
     },
     "execution_count": 136,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "78d634dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{31}{4}$"
      ],
      "text/plain": [
       "31/4"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.subs(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "id": "5a209fca",
   "metadata": {},
   "outputs": [],
   "source": [
    "data= {x:S(1)/2,y:-2}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "id": "8e017dd6",
   "metadata": {},
   "outputs": [],
   "source": [
    "n=symbols(\"n\",nature = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "31f7ade4",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr= x**(2*n+1)*y**(2*n+2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "id": "4093f0f9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2 n + 1} y  ^{2 n + 2}$"
      ],
      "text/plain": [
       "x**(2*n + 1)*y  **(2*n + 2)"
      ]
     },
     "execution_count": 151,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "id": "85de8ac7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\left(-2\\right)^{2 n + 1} \\cdot 4^{- n}$"
      ],
      "text/plain": [
       "-(-2)**(2*n + 1)/4**n"
      ]
     },
     "execution_count": 159,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "powsimp(expand(expr.subs(data)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "id": "695dc67d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(x - 2 y  \\right)^{2} \\cdot \\left(3 x - y  \\right)$"
      ],
      "text/plain": [
       "(x - 2*y  )**2*(3*x - y  )"
      ]
     },
     "execution_count": 160,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(3*x-y)*(x-2*y)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "id": "ab1ffebc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 3 x^{3} - 13 x^{2} y   + 16 x y  ^{2} - 4 y  ^{3}$"
      ],
      "text/plain": [
       "3*x**3 - 13*x**2*y   + 16*x*y  **2 - 4*y  **3"
      ]
     },
     "execution_count": 162,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ec0c518c",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = (-S(5)/3*a*b**3*c)*S(3)/10*a**2*b*c*(-8*a*b*c)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d7dae02",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "id": "e3aa2d09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(x - 2 y  \\right) \\left(3 x - y  \\right)$"
      ],
      "text/plain": [
       "(x - 2*y  )*(3*x - y  )"
      ]
     },
     "execution_count": 196,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(3*x-y)*(x-2*y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "id": "677278d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 3 x^{2} - 7 x y   + 2 y  ^{2}$"
      ],
      "text/plain": [
       "3*x**2 - 7*x*y   + 2*y  **2"
      ]
     },
     "execution_count": 197,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(_)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "66340659",
   "metadata": {},
   "source": [
    "## 八年级第十五章"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "id": "aea2fd5c",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr= (x/2-1)/(4-x)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "id": "dbd7c2f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\frac{x}{2} - 1}{\\left(4 - x\\right)^{2}}$"
      ],
      "text/plain": [
       "(x/2 - 1)/(4 - x)**2"
      ]
     },
     "execution_count": 164,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "id": "fdfe81ac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(2, 4\\right) \\cup \\left(4, \\infty\\right)$"
      ],
      "text/plain": [
       "Union(Interval.open(2, 4), Interval.open(4, oo))"
      ]
     },
     "execution_count": 165,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(expr>0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "id": "a1bfb7f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=(x**2-y**2)/(x+y)-(4*x*(x-y)+y**2)/(2*x-y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "id": "1a59d385",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{4 x \\left(x - y  \\right) + y  ^{2}}{2 x - y  } + \\frac{x^{2} - y  ^{2}}{x + y  }$"
      ],
      "text/plain": [
       "-(4*x*(x - y  ) + y  **2)/(2*x - y  ) + (x**2 - y  **2)/(x + y  )"
      ]
     },
     "execution_count": 167,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "id": "338bacf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - x$"
      ],
      "text/plain": [
       "-x"
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "id": "40a57f29",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=(a**2-b**2)/(a**2*b-a*b**2)/(1+(a**2+b**2)/(2*a*b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "id": "5deba1ca",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{a^{2} - b^{2}}{\\left(1 + \\frac{a^{2} + b^{2}}{2 a b}\\right) \\left(a^{2} b - a b^{2}\\right)}$"
      ],
      "text/plain": [
       "(a**2 - b**2)/((1 + (a**2 + b**2)/(2*a*b))*(a**2*b - a*b**2))"
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "id": "e406f978",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{2}{a + b}$"
      ],
      "text/plain": [
       "2/(a + b)"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "id": "435f11a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq=Eq((1-x)/(x-2),1/(x-x)-2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "id": "10217df6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\text{False}$"
      ],
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "id": "01c9ba1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq=Eq(x/(x-3),2+a/(x-3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "id": "bb314eae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{x}{x - 3} = \\frac{a}{x - 3} + 2$"
      ],
      "text/plain": [
       "Eq(x/(x - 3), a/(x - 3) + 2)"
      ]
     },
     "execution_count": 175,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "id": "042346a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(\\mathbb{R} \\cap \\left\\{6 - a\\right\\}\\right) \\setminus \\left\\{3\\right\\}$"
      ],
      "text/plain": [
       "Complement(Intersection({6 - a}, Reals), {3})"
      ]
     },
     "execution_count": 176,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "id": "24d95c39",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq=Eq(y/(y-1)-m**2/(y**2-y),(y-1)/y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "a8f436d7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{m^{2}}{y  ^{2} - y  } + \\frac{y  }{y   - 1} = \\frac{y   - 1}{y  }$"
      ],
      "text/plain": [
       "Eq(-m**2/(y  **2 - y  ) + y  /(y   - 1), (y   - 1)/y  )"
      ]
     },
     "execution_count": 178,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "id": "82156dd3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(\\mathbb{R} \\cap \\left\\{\\frac{m^{2} + 1}{2}\\right\\}\\right) \\setminus \\left\\{0, 1\\right\\}$"
      ],
      "text/plain": [
       "Complement(Intersection({(m**2 + 1)/2}, Reals), {0, 1})"
      ]
     },
     "execution_count": 179,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq,y,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "id": "012e9d1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([[3600,3600],[4800,2400]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "id": "6472a044",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}3600 & 3600\\\\4800 & 2400\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[3600, 3600],\n",
       "[4800, 2400]])"
      ]
     },
     "execution_count": 181,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 182,
   "id": "eb745e16",
   "metadata": {},
   "outputs": [],
   "source": [
    "b=Matrix([750,700])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "id": "09a865f9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}750\\\\700\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[750],\n",
       "[700]])"
      ]
     },
     "execution_count": 183,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "id": "b0b671d2",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function linsolve in module sympy.solvers.solveset:\n",
      "\n",
      "linsolve(system, *symbols)\n",
      "    Solve system of $N$ linear equations with $M$ variables; both\n",
      "    underdetermined and overdetermined systems are supported.\n",
      "    The possible number of solutions is zero, one or infinite.\n",
      "    Zero solutions throws a ValueError, whereas infinite\n",
      "    solutions are represented parametrically in terms of the given\n",
      "    symbols. For unique solution a :class:`~.FiniteSet` of ordered tuples\n",
      "    is returned.\n",
      "    \n",
      "    All standard input formats are supported:\n",
      "    For the given set of equations, the respective input types\n",
      "    are given below:\n",
      "    \n",
      "    .. math:: 3x + 2y -   z = 1\n",
      "    .. math:: 2x - 2y + 4z = -2\n",
      "    .. math:: 2x -   y + 2z = 0\n",
      "    \n",
      "    * Augmented matrix form, ``system`` given below:\n",
      "    \n",
      "    $$ \\text{system} = \\left[{array}{cccc}\n",
      "        3 &  2 & -1 &  1\\\\\n",
      "        2 & -2 &  4 & -2\\\\\n",
      "        2 & -1 &  2 &  0\n",
      "        \\end{array}\\right] $$\n",
      "    \n",
      "    ::\n",
      "    \n",
      "        system = Matrix([[3, 2, -1, 1], [2, -2, 4, -2], [2, -1, 2, 0]])\n",
      "    \n",
      "    * List of equations form\n",
      "    \n",
      "    ::\n",
      "    \n",
      "        system  =  [3x + 2y - z - 1, 2x - 2y + 4z + 2, 2x - y + 2z]\n",
      "    \n",
      "    * Input $A$ and $b$ in matrix form (from $Ax = b$) are given as:\n",
      "    \n",
      "    $$ A = \\left[\\begin{array}{ccc}\n",
      "        3 &  2 & -1 \\\\\n",
      "        2 & -2 &  4 \\\\\n",
      "        2 & -1 &  2\n",
      "        \\end{array}\\right] \\ \\  b = \\left[\\begin{array}{c}\n",
      "        1 \\\\ -2 \\\\ 0\n",
      "        \\end{array}\\right] $$\n",
      "    \n",
      "    ::\n",
      "    \n",
      "        A = Matrix([[3, 2, -1], [2, -2, 4], [2, -1, 2]])\n",
      "        b = Matrix([[1], [-2], [0]])\n",
      "        system = (A, b)\n",
      "    \n",
      "    Symbols can always be passed but are actually only needed\n",
      "    when 1) a system of equations is being passed and 2) the\n",
      "    system is passed as an underdetermined matrix and one wants\n",
      "    to control the name of the free variables in the result.\n",
      "    An error is raised if no symbols are used for case 1, but if\n",
      "    no symbols are provided for case 2, internally generated symbols\n",
      "    will be provided. When providing symbols for case 2, there should\n",
      "    be at least as many symbols are there are columns in matrix A.\n",
      "    \n",
      "    The algorithm used here is Gauss-Jordan elimination, which\n",
      "    results, after elimination, in a row echelon form matrix.\n",
      "    \n",
      "    Returns\n",
      "    =======\n",
      "    \n",
      "    A FiniteSet containing an ordered tuple of values for the\n",
      "    unknowns for which the `system` has a solution. (Wrapping\n",
      "    the tuple in FiniteSet is used to maintain a consistent\n",
      "    output format throughout solveset.)\n",
      "    \n",
      "    Returns EmptySet, if the linear system is inconsistent.\n",
      "    \n",
      "    Raises\n",
      "    ======\n",
      "    \n",
      "    ValueError\n",
      "        The input is not valid.\n",
      "        The symbols are not given.\n",
      "    \n",
      "    Examples\n",
      "    ========\n",
      "    \n",
      "    >>> from sympy import Matrix, linsolve, symbols\n",
      "    >>> x, y, z = symbols(\"x, y, z\")\n",
      "    >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 10]])\n",
      "    >>> b = Matrix([3, 6, 9])\n",
      "    >>> A\n",
      "    Matrix([\n",
      "    [1, 2,  3],\n",
      "    [4, 5,  6],\n",
      "    [7, 8, 10]])\n",
      "    >>> b\n",
      "    Matrix([\n",
      "    [3],\n",
      "    [6],\n",
      "    [9]])\n",
      "    >>> linsolve((A, b), [x, y, z])\n",
      "    {(-1, 2, 0)}\n",
      "    \n",
      "    * Parametric Solution: In case the system is underdetermined, the\n",
      "      function will return a parametric solution in terms of the given\n",
      "      symbols. Those that are free will be returned unchanged. e.g. in\n",
      "      the system below, `z` is returned as the solution for variable z;\n",
      "      it can take on any value.\n",
      "    \n",
      "    >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n",
      "    >>> b = Matrix([3, 6, 9])\n",
      "    >>> linsolve((A, b), x, y, z)\n",
      "    {(z - 1, 2 - 2*z, z)}\n",
      "    \n",
      "    If no symbols are given, internally generated symbols will be used.\n",
      "    The ``tau0`` in the third position indicates (as before) that the third\n",
      "    variable -- whatever it is named -- can take on any value:\n",
      "    \n",
      "    >>> linsolve((A, b))\n",
      "    {(tau0 - 1, 2 - 2*tau0, tau0)}\n",
      "    \n",
      "    * List of equations as input\n",
      "    \n",
      "    >>> Eqns = [3*x + 2*y - z - 1, 2*x - 2*y + 4*z + 2, - x + y/2 - z]\n",
      "    >>> linsolve(Eqns, x, y, z)\n",
      "    {(1, -2, -2)}\n",
      "    \n",
      "    * Augmented matrix as input\n",
      "    \n",
      "    >>> aug = Matrix([[2, 1, 3, 1], [2, 6, 8, 3], [6, 8, 18, 5]])\n",
      "    >>> aug\n",
      "    Matrix([\n",
      "    [2, 1,  3, 1],\n",
      "    [2, 6,  8, 3],\n",
      "    [6, 8, 18, 5]])\n",
      "    >>> linsolve(aug, x, y, z)\n",
      "    {(3/10, 2/5, 0)}\n",
      "    \n",
      "    * Solve for symbolic coefficients\n",
      "    \n",
      "    >>> a, b, c, d, e, f = symbols('a, b, c, d, e, f')\n",
      "    >>> eqns = [a*x + b*y - c, d*x + e*y - f]\n",
      "    >>> linsolve(eqns, x, y)\n",
      "    {((-b*f + c*e)/(a*e - b*d), (a*f - c*d)/(a*e - b*d))}\n",
      "    \n",
      "    * A degenerate system returns solution as set of given\n",
      "      symbols.\n",
      "    \n",
      "    >>> system = Matrix(([0, 0, 0], [0, 0, 0], [0, 0, 0]))\n",
      "    >>> linsolve(system, x, y)\n",
      "    {(x, y)}\n",
      "    \n",
      "    * For an empty system linsolve returns empty set\n",
      "    \n",
      "    >>> linsolve([], x)\n",
      "    EmptySet\n",
      "    \n",
      "    * An error is raised if any nonlinearity is detected, even\n",
      "      if it could be removed with expansion\n",
      "    \n",
      "    >>> linsolve([x*(1/x - 1)], x)\n",
      "    Traceback (most recent call last):\n",
      "    ...\n",
      "    NonlinearError: nonlinear term: 1/x\n",
      "    \n",
      "    >>> linsolve([x*(y + 1)], x, y)\n",
      "    Traceback (most recent call last):\n",
      "    ...\n",
      "    NonlinearError: nonlinear cross-term: x*(y + 1)\n",
      "    \n",
      "    >>> linsolve([x**2 - 1], x)\n",
      "    Traceback (most recent call last):\n",
      "    ...\n",
      "    NonlinearError: nonlinear term: x**2\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(linsolve)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 188,
   "id": "cb7d7d7b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\left( \\frac{1}{12}, \\  \\frac{1}{8}\\right)\\right\\}$"
      ],
      "text/plain": [
       "{(1/12, 1/8)}"
      ]
     },
     "execution_count": 188,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linsolve((A,b),[x,y])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 189,
   "id": "4a8f1272",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(- \\frac{1}{2}, \\frac{3}{2}\\right)$"
      ],
      "text/plain": [
       "Interval.open(-1/2, 3/2)"
      ]
     },
     "execution_count": 189,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_univariate_inequalities([2*a+1>0,2*a-3<0],a,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "id": "cc5f434c",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq=Eq(1/(x-3)+4,(2-x)/(3-x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "id": "7123112b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 4 + \\frac{1}{x - 3} = \\frac{2 - x}{3 - x}$"
      ],
      "text/plain": [
       "Eq(4 + 1/(x - 3), (2 - x)/(3 - x))"
      ]
     },
     "execution_count": 191,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "id": "894e5653",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\emptyset$"
      ],
      "text/plain": [
       "EmptySet"
      ]
     },
     "execution_count": 192,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "id": "e3649461",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\mathbb{N} \\cap \\left\\{10 - \\frac{3 y  }{5}\\right\\}$"
      ],
      "text/plain": [
       "Intersection({10 - 3*y  /5}, Naturals)"
      ]
     },
     "execution_count": 195,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(100*x+60*y-1000,x,Naturals)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bcfacb0",
   "metadata": {},
   "source": [
    "### 九年级第22章"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "id": "1d26e8f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(Poly.from_list([S(1)/2,1,-1],x).as_expr())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "id": "5b4582e9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\left(x + 1\\right)^{2}}{2} - \\frac{3}{2}$"
      ],
      "text/plain": [
       "(x + 1)**2/2 - 3/2"
      ]
     },
     "execution_count": 203,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry_equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "id": "ee43313d",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(m-1,-m,-m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "id": "e592d0be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{m \\left(4 - 5 m\\right)}{4 \\left(m - 1\\right)} + \\left(m - 1\\right) \\left(- \\frac{m}{2 m - 2} + x\\right)^{2}$"
      ],
      "text/plain": [
       "m*(4 - 5*m)/(4*(m - 1)) + (m - 1)*(-m/(2*m - 2) + x)**2"
      ]
     },
     "execution_count": 205,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry_equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "id": "8bc6f63f",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(-S(1)/12,S(2)/3,S(5)/3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 207,
   "id": "5472e220",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2, 10\\right\\}$"
      ],
      "text/plain": [
       "{-2, 10}"
      ]
     },
     "execution_count": 207,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.roots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "id": "b1970d7c",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(-1,2,c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "id": "152bebf5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 209,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 212,
   "id": "002d4fa8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\left(x + 1\\right)^{2}}{2} + 2$"
      ],
      "text/plain": [
       "(x + 1)**2/2 + 2"
      ]
     },
     "execution_count": 212,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transfer_function(x**2/2-1,x,move=-1,lift=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 260,
   "id": "d9d294a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c = symbols(\"a,b,c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 261,
   "id": "58b3de6c",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(a,b,c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 262,
   "id": "df1b4eee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle a x^{2} + b x + c$"
      ],
      "text/plain": [
       "a*x**2 + b*x + c"
      ]
     },
     "execution_count": 262,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 263,
   "id": "f0c540f4",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq1=Eq(q.extreme_value,4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 264,
   "id": "96f012ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle c - \\frac{b^{2}}{4 a} = 4$"
      ],
      "text/plain": [
       "Eq(c - b**2/(4*a), 4)"
      ]
     },
     "execution_count": 264,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 265,
   "id": "b5ff290c",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq2=Eq(q.symmetry,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 266,
   "id": "c338c727",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{b}{2 a} = 1$"
      ],
      "text/plain": [
       "Eq(-b/(2*a), 1)"
      ]
     },
     "execution_count": 266,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 275,
   "id": "6ec7b53a",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq3=Eq(sqrt(q.delta),abs(4*a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 276,
   "id": "d18467ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{- 4 a c + b^{2}} = 4 \\left|{a}\\right|$"
      ],
      "text/plain": [
       "Eq(sqrt(-4*a*c + b**2), 4*Abs(a))"
      ]
     },
     "execution_count": 276,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59db2479",
   "metadata": {},
   "source": [
    "# 这是一个大大的BUG！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 290,
   "id": "f705c07e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\left( a, \\  b, \\  \\frac{b^{2} - 16 \\left|{a}\\right|^{2}}{4 a}\\right)\\right\\}$"
      ],
      "text/plain": [
       "{(a, b, (b**2 - 16*Abs(a)**2)/(4*a))}"
      ]
     },
     "execution_count": 290,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nonlinsolve([eq1,eq3,eq2],[a,b,c],Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 286,
   "id": "dbe8151f",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(-1/S(2),S(1),S(3)/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "id": "08ce768d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 1$"
      ],
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 287,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 288,
   "id": "4d786394",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2$"
      ],
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 288,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S(q.extreme_value)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "id": "b94a5468",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-1, 3\\right\\}$"
      ],
      "text/plain": [
       "{-1, 3}"
      ]
     },
     "execution_count": 289,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.roots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 292,
   "id": "4318e7c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "t=symbols(\"t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 302,
   "id": "d37a894a",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction((100+4*t)*(45-t),x=t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 299,
   "id": "3518fd14",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 4 x^{2} + 80 x + 4500$"
      ],
      "text/plain": [
       "-4*x**2 + 80*x + 4500"
      ]
     },
     "execution_count": 299,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 300,
   "id": "b1e88057",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 4900$"
      ],
      "text/plain": [
       "4900"
      ]
     },
     "execution_count": 300,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.extreme_value"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 331,
   "id": "22431539",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 10$"
      ],
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 331,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 357,
   "id": "66ee0687",
   "metadata": {},
   "outputs": [],
   "source": [
    "q= QuadraticFunction(Point(0,20),Point(5,39),Point(10,48))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 358,
   "id": "9b01d300",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{x^{2}}{5} + \\frac{24 x}{5} + 20$"
      ],
      "text/plain": [
       "-x**2/5 + 24*x/5 + 20"
      ]
     },
     "execution_count": 358,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 342,
   "id": "3b6c64a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{4, 20\\right\\}$"
      ],
      "text/plain": [
       "{4, 20}"
      ]
     },
     "execution_count": 342,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(q.equation(x)-36)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 344,
   "id": "fa51a41e",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(k**2,-(2*k+1),1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 346,
   "id": "ef35213b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle k^{2} x^{2} + x \\left(- 2 k - 1\\right) + 1$"
      ],
      "text/plain": [
       "k**2*x**2 + x*(-2*k - 1) + 1"
      ]
     },
     "execution_count": 346,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 349,
   "id": "a278a3aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(- \\frac{1}{4}, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval.open(-1/4, oo)"
      ]
     },
     "execution_count": 349,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(q.delta>0,k,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 350,
   "id": "bc73e667",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0.9$"
      ],
      "text/plain": [
       "0.900000000000000"
      ]
     },
     "execution_count": 350,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt(48.6/S(60))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 351,
   "id": "ff5dfcbf",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(1,4,-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 352,
   "id": "365eae91",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2 + \\sqrt{5}, - \\sqrt{5} - 2\\right\\}$"
      ],
      "text/plain": [
       "{-2 + sqrt(5), -sqrt(5) - 2}"
      ]
     },
     "execution_count": 352,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.roots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 353,
   "id": "362015cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 17$"
      ],
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 353,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt(289)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 356,
   "id": "f58beb81",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2, 1\\right\\}$"
      ],
      "text/plain": [
       "{-2, 1}"
      ]
     },
     "execution_count": 356,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(x**2-abs(x-1)-1,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 359,
   "id": "719b600e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 28 x + 20 y - 1520$"
      ],
      "text/plain": [
       "28*x + 20*y - 1520"
      ]
     },
     "execution_count": 359,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Line(Point(20,48),Point(40,20)).equation()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5287f0b7",
   "metadata": {},
   "source": [
    "#### 自我学习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 360,
   "id": "cdeea142",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class gamma in module sympy.functions.special.gamma_functions:\n",
      "\n",
      "class gamma(sympy.core.function.Function)\n",
      " |  gamma(arg)\n",
      " |  \n",
      " |  The gamma function\n",
      " |  \n",
      " |  .. math::\n",
      " |      \\Gamma(x) := \\int^{\\infty}_{0} t^{x-1} e^{-t} \\mathrm{d}t.\n",
      " |  \n",
      " |  Explanation\n",
      " |  ===========\n",
      " |  \n",
      " |  The ``gamma`` function implements the function which passes through the\n",
      " |  values of the factorial function (i.e., $\\Gamma(n) = (n - 1)!$ when n is\n",
      " |  an integer). More generally, $\\Gamma(z)$ is defined in the whole complex\n",
      " |  plane except at the negative integers where there are simple poles.\n",
      " |  \n",
      " |  Examples\n",
      " |  ========\n",
      " |  \n",
      " |  >>> from sympy import S, I, pi, gamma\n",
      " |  >>> from sympy.abc import x\n",
      " |  \n",
      " |  Several special values are known:\n",
      " |  \n",
      " |  >>> gamma(1)\n",
      " |  1\n",
      " |  >>> gamma(4)\n",
      " |  6\n",
      " |  >>> gamma(S(3)/2)\n",
      " |  sqrt(pi)/2\n",
      " |  \n",
      " |  The ``gamma`` function obeys the mirror symmetry:\n",
      " |  \n",
      " |  >>> from sympy import conjugate\n",
      " |  >>> conjugate(gamma(x))\n",
      " |  gamma(conjugate(x))\n",
      " |  \n",
      " |  Differentiation with respect to $x$ is supported:\n",
      " |  \n",
      " |  >>> from sympy import diff\n",
      " |  >>> diff(gamma(x), x)\n",
      " |  gamma(x)*polygamma(0, x)\n",
      " |  \n",
      " |  Series expansion is also supported:\n",
      " |  \n",
      " |  >>> from sympy import series\n",
      " |  >>> series(gamma(x), x, 0, 3)\n",
      " |  1/x - EulerGamma + x*(EulerGamma**2/2 + pi**2/12) + x**2*(-EulerGamma*pi**2/12 - zeta(3)/3 - EulerGamma**3/6) + O(x**3)\n",
      " |  \n",
      " |  We can numerically evaluate the ``gamma`` function to arbitrary precision\n",
      " |  on the whole complex plane:\n",
      " |  \n",
      " |  >>> gamma(pi).evalf(40)\n",
      " |  2.288037795340032417959588909060233922890\n",
      " |  >>> gamma(1+I).evalf(20)\n",
      " |  0.49801566811835604271 - 0.15494982830181068512*I\n",
      " |  \n",
      " |  See Also\n",
      " |  ========\n",
      " |  \n",
      " |  lowergamma: Lower incomplete gamma function.\n",
      " |  uppergamma: Upper incomplete gamma function.\n",
      " |  polygamma: Polygamma function.\n",
      " |  loggamma: Log Gamma function.\n",
      " |  digamma: Digamma function.\n",
      " |  trigamma: Trigamma function.\n",
      " |  beta: Euler Beta function.\n",
      " |  \n",
      " |  References\n",
      " |  ==========\n",
      " |  \n",
      " |  .. [1] https://en.wikipedia.org/wiki/Gamma_function\n",
      " |  .. [2] https://dlmf.nist.gov/5\n",
      " |  .. [3] https://mathworld.wolfram.com/GammaFunction.html\n",
      " |  .. [4] https://functions.wolfram.com/GammaBetaErf/Gamma/\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      gamma\n",
      " |      sympy.core.function.Function\n",
      " |      sympy.core.function.Application\n",
      " |      sympy.core.expr.Expr\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  fdiff(self, argindex=1)\n",
      " |      Returns the first derivative of the function.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods defined here:\n",
      " |  \n",
      " |  eval(arg) from sympy.core.function.FunctionClass\n",
      " |      Returns a canonical form of cls applied to arguments args.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      The ``eval()`` method is called when the class ``cls`` is about to be\n",
      " |      instantiated and it should return either some simplified instance\n",
      " |      (possible of some other class), or if the class ``cls`` should be\n",
      " |      unmodified, return None.\n",
      " |      \n",
      " |      Examples of ``eval()`` for the function \"sign\"\n",
      " |      \n",
      " |      .. code-block:: python\n",
      " |      \n",
      " |          @classmethod\n",
      " |          def eval(cls, arg):\n",
      " |              if arg is S.NaN:\n",
      " |                  return S.NaN\n",
      " |              if arg.is_zero: return S.Zero\n",
      " |              if arg.is_positive: return S.One\n",
      " |              if arg.is_negative: return S.NegativeOne\n",
      " |              if isinstance(arg, Mul):\n",
      " |                  coeff, terms = arg.as_coeff_Mul(rational=True)\n",
      " |                  if coeff is not S.One:\n",
      " |                      return cls(coeff) * cls(terms)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  default_assumptions = {}\n",
      " |  \n",
      " |  unbranched = True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.function.Function:\n",
      " |  \n",
      " |  as_base_exp(self)\n",
      " |      Returns the method as the 2-tuple (base, exponent).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.function.Function:\n",
      " |  \n",
      " |  class_key() from sympy.core.function.FunctionClass\n",
      " |      Nice order of classes.\n",
      " |  \n",
      " |  is_singular(a) from sympy.core.function.FunctionClass\n",
      " |      Tests whether the argument is an essential singularity\n",
      " |      or a branch point, or the functions is non-holomorphic.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods inherited from sympy.core.function.Function:\n",
      " |  \n",
      " |  __new__(cls, *args, **options)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.function.Function:\n",
      " |  \n",
      " |  __annotations__ = {'_singularities': 'FuzzyBool | tuple[Expr, ...]'}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.function.Application:\n",
      " |  \n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |      \n",
      " |      The following should hold for all objects::\n",
      " |      \n",
      " |          >> x == x.func(*x.args)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from sympy.core.function.Application:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.function.Application:\n",
      " |  \n",
      " |  is_Function = True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  __abs__(self) -> 'Expr'\n",
      " |  \n",
      " |  __add__(self, other)\n",
      " |  \n",
      " |  __complex__(self)\n",
      " |  \n",
      " |  __divmod__(self, other)\n",
      " |  \n",
      " |  __float__(self)\n",
      " |  \n",
      " |  __floordiv__(self, other)\n",
      " |  \n",
      " |  __format__(self, format_spec: 'str')\n",
      " |      Default object formatter.\n",
      " |  \n",
      " |  __ge__(self, other)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __gt__(self, other)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __int__(self)\n",
      " |  \n",
      " |  __le__(self, other)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __lt__(self, other)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __mod__(self, other)\n",
      " |  \n",
      " |  __mul__(self, other)\n",
      " |  \n",
      " |  __neg__(self)\n",
      " |  \n",
      " |  __pos__(self)\n",
      " |  \n",
      " |  __pow__(self, other, mod=None) -> 'Expr'\n",
      " |  \n",
      " |  __radd__(self, other)\n",
      " |  \n",
      " |  __rdivmod__(self, other)\n",
      " |  \n",
      " |  __rfloordiv__(self, other)\n",
      " |  \n",
      " |  __rmod__(self, other)\n",
      " |  \n",
      " |  __rmul__(self, other)\n",
      " |  \n",
      " |  __round__ = round(self, n=None)\n",
      " |  \n",
      " |  __rpow__(self, other)\n",
      " |  \n",
      " |  __rsub__(self, other)\n",
      " |  \n",
      " |  __rtruediv__(self, other)\n",
      " |  \n",
      " |  __sub__(self, other)\n",
      " |  \n",
      " |  __truediv__(self, other)\n",
      " |  \n",
      " |  __trunc__(self)\n",
      " |  \n",
      " |  adjoint(self)\n",
      " |  \n",
      " |  apart(self, x=None, **args)\n",
      " |      See the apart function in sympy.polys\n",
      " |  \n",
      " |  args_cnc(self, cset=False, warn=True, split_1=True)\n",
      " |      Return [commutative factors, non-commutative factors] of self.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      self is treated as a Mul and the ordering of the factors is maintained.\n",
      " |      If ``cset`` is True the commutative factors will be returned in a set.\n",
      " |      If there were repeated factors (as may happen with an unevaluated Mul)\n",
      " |      then an error will be raised unless it is explicitly suppressed by\n",
      " |      setting ``warn`` to False.\n",
      " |      \n",
      " |      Note: -1 is always separated from a Number unless split_1 is False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, oo\n",
      " |      >>> A, B = symbols('A B', commutative=0)\n",
      " |      >>> x, y = symbols('x y')\n",
      " |      >>> (-2*x*y).args_cnc()\n",
      " |      [[-1, 2, x, y], []]\n",
      " |      >>> (-2.5*x).args_cnc()\n",
      " |      [[-1, 2.5, x], []]\n",
      " |      >>> (-2*x*A*B*y).args_cnc()\n",
      " |      [[-1, 2, x, y], [A, B]]\n",
      " |      >>> (-2*x*A*B*y).args_cnc(split_1=False)\n",
      " |      [[-2, x, y], [A, B]]\n",
      " |      >>> (-2*x*y).args_cnc(cset=True)\n",
      " |      [{-1, 2, x, y}, []]\n",
      " |      \n",
      " |      The arg is always treated as a Mul:\n",
      " |      \n",
      " |      >>> (-2 + x + A).args_cnc()\n",
      " |      [[], [x - 2 + A]]\n",
      " |      >>> (-oo).args_cnc() # -oo is a singleton\n",
      " |      [[-1, oo], []]\n",
      " |  \n",
      " |  as_coeff_Add(self, rational=False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a summation.\n",
      " |  \n",
      " |  as_coeff_Mul(self, rational: 'bool' = False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a product.\n",
      " |  \n",
      " |  as_coeff_add(self, *deps) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as an Add, ``a``.\n",
      " |      \n",
      " |      c should be a Rational added to any terms of the Add that are\n",
      " |      independent of deps.\n",
      " |      \n",
      " |      args should be a tuple of all other terms of ``a``; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |      \n",
      " |      This should be used when you do not know if self is an Add or not but\n",
      " |      you want to treat self as an Add or if you want to process the\n",
      " |      individual arguments of the tail of self as an Add.\n",
      " |      \n",
      " |      - if you know self is an Add and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail.\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_add()\n",
      " |      (3, ())\n",
      " |      >>> (3 + x).as_coeff_add()\n",
      " |      (3, (x,))\n",
      " |      >>> (3 + x + y).as_coeff_add(x)\n",
      " |      (y + 3, (x,))\n",
      " |      >>> (3 + y).as_coeff_add(x)\n",
      " |      (y + 3, ())\n",
      " |  \n",
      " |  as_coeff_exponent(self, x) -> 'tuple[Expr, Expr]'\n",
      " |      ``c*x**e -> c,e`` where x can be any symbolic expression.\n",
      " |  \n",
      " |  as_coeff_mul(self, *deps, **kwargs) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as a Mul, ``m``.\n",
      " |      \n",
      " |      c should be a Rational multiplied by any factors of the Mul that are\n",
      " |      independent of deps.\n",
      " |      \n",
      " |      args should be a tuple of all other factors of m; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |      \n",
      " |      This should be used when you do not know if self is a Mul or not but\n",
      " |      you want to treat self as a Mul or if you want to process the\n",
      " |      individual arguments of the tail of self as a Mul.\n",
      " |      \n",
      " |      - if you know self is a Mul and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail;\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_mul()\n",
      " |      (3, ())\n",
      " |      >>> (3*x*y).as_coeff_mul()\n",
      " |      (3, (x, y))\n",
      " |      >>> (3*x*y).as_coeff_mul(x)\n",
      " |      (3*y, (x,))\n",
      " |      >>> (3*y).as_coeff_mul(x)\n",
      " |      (3*y, ())\n",
      " |  \n",
      " |  as_coefficient(self, expr)\n",
      " |      Extracts symbolic coefficient at the given expression. In\n",
      " |      other words, this functions separates 'self' into the product\n",
      " |      of 'expr' and 'expr'-free coefficient. If such separation\n",
      " |      is not possible it will return None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import E, pi, sin, I, Poly\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> E.as_coefficient(E)\n",
      " |      1\n",
      " |      >>> (2*E).as_coefficient(E)\n",
      " |      2\n",
      " |      >>> (2*sin(E)*E).as_coefficient(E)\n",
      " |      \n",
      " |      Two terms have E in them so a sum is returned. (If one were\n",
      " |      desiring the coefficient of the term exactly matching E then\n",
      " |      the constant from the returned expression could be selected.\n",
      " |      Or, for greater precision, a method of Poly can be used to\n",
      " |      indicate the desired term from which the coefficient is\n",
      " |      desired.)\n",
      " |      \n",
      " |      >>> (2*E + x*E).as_coefficient(E)\n",
      " |      x + 2\n",
      " |      >>> _.args[0]  # just want the exact match\n",
      " |      2\n",
      " |      >>> p = Poly(2*E + x*E); p\n",
      " |      Poly(x*E + 2*E, x, E, domain='ZZ')\n",
      " |      >>> p.coeff_monomial(E)\n",
      " |      2\n",
      " |      >>> p.nth(0, 1)\n",
      " |      2\n",
      " |      \n",
      " |      Since the following cannot be written as a product containing\n",
      " |      E as a factor, None is returned. (If the coefficient ``2*x`` is\n",
      " |      desired then the ``coeff`` method should be used.)\n",
      " |      \n",
      " |      >>> (2*E*x + x).as_coefficient(E)\n",
      " |      >>> (2*E*x + x).coeff(E)\n",
      " |      2*x\n",
      " |      \n",
      " |      >>> (E*(x + 1) + x).as_coefficient(E)\n",
      " |      \n",
      " |      >>> (2*pi*I).as_coefficient(pi*I)\n",
      " |      2\n",
      " |      >>> (2*I).as_coefficient(pi*I)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      coeff: return sum of terms have a given factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |  \n",
      " |  as_coefficients_dict(self, *syms)\n",
      " |      Return a dictionary mapping terms to their Rational coefficient.\n",
      " |      Since the dictionary is a defaultdict, inquiries about terms which\n",
      " |      were not present will return a coefficient of 0.\n",
      " |      \n",
      " |      If symbols ``syms`` are provided, any multiplicative terms\n",
      " |      independent of them will be considered a coefficient and a\n",
      " |      regular dictionary of syms-dependent generators as keys and\n",
      " |      their corresponding coefficients as values will be returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import a, x, y\n",
      " |      >>> (3*x + a*x + 4).as_coefficients_dict()\n",
      " |      {1: 4, x: 3, a*x: 1}\n",
      " |      >>> _[a]\n",
      " |      0\n",
      " |      >>> (3*a*x).as_coefficients_dict()\n",
      " |      {a*x: 3}\n",
      " |      >>> (3*a*x).as_coefficients_dict(x)\n",
      " |      {x: 3*a}\n",
      " |      >>> (3*a*x).as_coefficients_dict(y)\n",
      " |      {1: 3*a*x}\n",
      " |  \n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      This method should recursively remove a Rational from all arguments\n",
      " |      and return that (content) and the new self (primitive). The content\n",
      " |      should always be positive and ``Mul(*foo.as_content_primitive()) == foo``.\n",
      " |      The primitive need not be in canonical form and should try to preserve\n",
      " |      the underlying structure if possible (i.e. expand_mul should not be\n",
      " |      applied to self).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      >>> eq = 2 + 2*x + 2*y*(3 + 3*y)\n",
      " |      \n",
      " |      The as_content_primitive function is recursive and retains structure:\n",
      " |      \n",
      " |      >>> eq.as_content_primitive()\n",
      " |      (2, x + 3*y*(y + 1) + 1)\n",
      " |      \n",
      " |      Integer powers will have Rationals extracted from the base:\n",
      " |      \n",
      " |      >>> ((2 + 6*x)**2).as_content_primitive()\n",
      " |      (4, (3*x + 1)**2)\n",
      " |      >>> ((2 + 6*x)**(2*y)).as_content_primitive()\n",
      " |      (1, (2*(3*x + 1))**(2*y))\n",
      " |      \n",
      " |      Terms may end up joining once their as_content_primitives are added:\n",
      " |      \n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (11, x*(y + 1))\n",
      " |      >>> ((3*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (9, x*(y + 1))\n",
      " |      >>> ((3*(z*(1 + y)) + 2.0*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (1, 6.0*x*(y + 1) + 3*z*(y + 1))\n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (121, x**2*(y + 1)**2)\n",
      " |      >>> ((x*(1 + y) + 0.4*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (1, 4.84*x**2*(y + 1)**2)\n",
      " |      \n",
      " |      Radical content can also be factored out of the primitive:\n",
      " |      \n",
      " |      >>> (2*sqrt(2) + 4*sqrt(10)).as_content_primitive(radical=True)\n",
      " |      (2, sqrt(2)*(1 + 2*sqrt(5)))\n",
      " |      \n",
      " |      If clear=False (default is True) then content will not be removed\n",
      " |      from an Add if it can be distributed to leave one or more\n",
      " |      terms with integer coefficients.\n",
      " |      \n",
      " |      >>> (x/2 + y).as_content_primitive()\n",
      " |      (1/2, x + 2*y)\n",
      " |      >>> (x/2 + y).as_content_primitive(clear=False)\n",
      " |      (1, x/2 + y)\n",
      " |  \n",
      " |  as_expr(self, *gens)\n",
      " |      Convert a polynomial to a SymPy expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> f = (x**2 + x*y).as_poly(x, y)\n",
      " |      >>> f.as_expr()\n",
      " |      x**2 + x*y\n",
      " |      \n",
      " |      >>> sin(x).as_expr()\n",
      " |      sin(x)\n",
      " |  \n",
      " |  as_independent(self, *deps, **hint) -> 'tuple[Expr, Expr]'\n",
      " |      A mostly naive separation of a Mul or Add into arguments that are not\n",
      " |      are dependent on deps. To obtain as complete a separation of variables\n",
      " |      as possible, use a separation method first, e.g.:\n",
      " |      \n",
      " |      * separatevars() to change Mul, Add and Pow (including exp) into Mul\n",
      " |      * .expand(mul=True) to change Add or Mul into Add\n",
      " |      * .expand(log=True) to change log expr into an Add\n",
      " |      \n",
      " |      The only non-naive thing that is done here is to respect noncommutative\n",
      " |      ordering of variables and to always return (0, 0) for `self` of zero\n",
      " |      regardless of hints.\n",
      " |      \n",
      " |      For nonzero `self`, the returned tuple (i, d) has the\n",
      " |      following interpretation:\n",
      " |      \n",
      " |      * i will has no variable that appears in deps\n",
      " |      * d will either have terms that contain variables that are in deps, or\n",
      " |        be equal to 0 (when self is an Add) or 1 (when self is a Mul)\n",
      " |      * if self is an Add then self = i + d\n",
      " |      * if self is a Mul then self = i*d\n",
      " |      * otherwise (self, S.One) or (S.One, self) is returned.\n",
      " |      \n",
      " |      To force the expression to be treated as an Add, use the hint as_Add=True\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      -- self is an Add\n",
      " |      \n",
      " |      >>> from sympy import sin, cos, exp\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      >>> (x + x*y).as_independent(x)\n",
      " |      (0, x*y + x)\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x)\n",
      " |      (y + z, 2*x*sin(x) + x)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x, y)\n",
      " |      (z, 2*x*sin(x) + x + y)\n",
      " |      \n",
      " |      -- self is a Mul\n",
      " |      \n",
      " |      >>> (x*sin(x)*cos(y)).as_independent(x)\n",
      " |      (cos(y), x*sin(x))\n",
      " |      \n",
      " |      non-commutative terms cannot always be separated out when self is a Mul\n",
      " |      \n",
      " |      >>> from sympy import symbols\n",
      " |      >>> n1, n2, n3 = symbols('n1 n2 n3', commutative=False)\n",
      " |      >>> (n1 + n1*n2).as_independent(n2)\n",
      " |      (n1, n1*n2)\n",
      " |      >>> (n2*n1 + n1*n2).as_independent(n2)\n",
      " |      (0, n1*n2 + n2*n1)\n",
      " |      >>> (n1*n2*n3).as_independent(n1)\n",
      " |      (1, n1*n2*n3)\n",
      " |      >>> (n1*n2*n3).as_independent(n2)\n",
      " |      (n1, n2*n3)\n",
      " |      >>> ((x-n1)*(x-y)).as_independent(x)\n",
      " |      (1, (x - y)*(x - n1))\n",
      " |      \n",
      " |      -- self is anything else:\n",
      " |      \n",
      " |      >>> (sin(x)).as_independent(x)\n",
      " |      (1, sin(x))\n",
      " |      >>> (sin(x)).as_independent(y)\n",
      " |      (sin(x), 1)\n",
      " |      >>> exp(x+y).as_independent(x)\n",
      " |      (1, exp(x + y))\n",
      " |      \n",
      " |      -- force self to be treated as an Add:\n",
      " |      \n",
      " |      >>> (3*x).as_independent(x, as_Add=True)\n",
      " |      (0, 3*x)\n",
      " |      \n",
      " |      -- force self to be treated as a Mul:\n",
      " |      \n",
      " |      >>> (3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x + 3)\n",
      " |      >>> (-3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x - 3)\n",
      " |      \n",
      " |      Note how the below differs from the above in making the\n",
      " |      constant on the dep term positive.\n",
      " |      \n",
      " |      >>> (y*(-3+x)).as_independent(x)\n",
      " |      (y, x - 3)\n",
      " |      \n",
      " |      -- use .as_independent() for true independence testing instead\n",
      " |         of .has(). The former considers only symbols in the free\n",
      " |         symbols while the latter considers all symbols\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> I = Integral(x, (x, 1, 2))\n",
      " |      >>> I.has(x)\n",
      " |      True\n",
      " |      >>> x in I.free_symbols\n",
      " |      False\n",
      " |      >>> I.as_independent(x) == (I, 1)\n",
      " |      True\n",
      " |      >>> (I + x).as_independent(x) == (I, x)\n",
      " |      True\n",
      " |      \n",
      " |      Note: when trying to get independent terms, a separation method\n",
      " |      might need to be used first. In this case, it is important to keep\n",
      " |      track of what you send to this routine so you know how to interpret\n",
      " |      the returned values\n",
      " |      \n",
      " |      >>> from sympy import separatevars, log\n",
      " |      >>> separatevars(exp(x+y)).as_independent(x)\n",
      " |      (exp(y), exp(x))\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> separatevars(x + x*y).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).expand(mul=True).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> a, b=symbols('a b', positive=True)\n",
      " |      >>> (log(a*b).expand(log=True)).as_independent(b)\n",
      " |      (log(a), log(b))\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      separatevars\n",
      " |      expand_log\n",
      " |      sympy.core.add.Add.as_two_terms\n",
      " |      sympy.core.mul.Mul.as_two_terms\n",
      " |      as_coeff_mul\n",
      " |  \n",
      " |  as_leading_term(self, *symbols, logx=None, cdir=0)\n",
      " |      Returns the leading (nonzero) term of the series expansion of self.\n",
      " |      \n",
      " |      The _eval_as_leading_term routines are used to do this, and they must\n",
      " |      always return a non-zero value.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + x**2).as_leading_term(x)\n",
      " |      1\n",
      " |      >>> (1/x**2 + x + x**2).as_leading_term(x)\n",
      " |      x**(-2)\n",
      " |  \n",
      " |  as_numer_denom(self)\n",
      " |      Return the numerator and the denominator of an expression.\n",
      " |      \n",
      " |      expression -> a/b -> a, b\n",
      " |      \n",
      " |      This is just a stub that should be defined by\n",
      " |      an object's class methods to get anything else.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      normal: return ``a/b`` instead of ``(a, b)``\n",
      " |  \n",
      " |  as_ordered_factors(self, order=None)\n",
      " |      Return list of ordered factors (if Mul) else [self].\n",
      " |  \n",
      " |  as_ordered_terms(self, order=None, data=False)\n",
      " |      Transform an expression to an ordered list of terms.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, cos\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> (sin(x)**2*cos(x) + sin(x)**2 + 1).as_ordered_terms()\n",
      " |      [sin(x)**2*cos(x), sin(x)**2, 1]\n",
      " |  \n",
      " |  as_poly(self, *gens, **args)\n",
      " |      Converts ``self`` to a polynomial or returns ``None``.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> print((x**2 + x*y).as_poly())\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |      \n",
      " |      >>> print((x**2 + x*y).as_poly(x, y))\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |      \n",
      " |      >>> print((x**2 + sin(y)).as_poly(x, y))\n",
      " |      None\n",
      " |  \n",
      " |  as_powers_dict(self)\n",
      " |      Return self as a dictionary of factors with each factor being\n",
      " |      treated as a power. The keys are the bases of the factors and the\n",
      " |      values, the corresponding exponents. The resulting dictionary should\n",
      " |      be used with caution if the expression is a Mul and contains non-\n",
      " |      commutative factors since the order that they appeared will be lost in\n",
      " |      the dictionary.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      as_ordered_factors: An alternative for noncommutative applications,\n",
      " |                          returning an ordered list of factors.\n",
      " |      args_cnc: Similar to as_ordered_factors, but guarantees separation\n",
      " |                of commutative and noncommutative factors.\n",
      " |  \n",
      " |  as_real_imag(self, deep=True, **hints)\n",
      " |      Performs complex expansion on 'self' and returns a tuple\n",
      " |      containing collected both real and imaginary parts. This\n",
      " |      method cannot be confused with re() and im() functions,\n",
      " |      which does not perform complex expansion at evaluation.\n",
      " |      \n",
      " |      However it is possible to expand both re() and im()\n",
      " |      functions and get exactly the same results as with\n",
      " |      a single call to this function.\n",
      " |      \n",
      " |      >>> from sympy import symbols, I\n",
      " |      \n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |      \n",
      " |      >>> (x + y*I).as_real_imag()\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> from sympy.abc import z, w\n",
      " |      \n",
      " |      >>> (z + w*I).as_real_imag()\n",
      " |      (re(z) - im(w), re(w) + im(z))\n",
      " |  \n",
      " |  as_terms(self)\n",
      " |      Transform an expression to a list of terms.\n",
      " |  \n",
      " |  aseries(self, x=None, n=6, bound=0, hir=False)\n",
      " |      Asymptotic Series expansion of self.\n",
      " |      This is equivalent to ``self.series(x, oo, n)``.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      self : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |      \n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |      \n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |      \n",
      " |      hir : Boolean\n",
      " |            Set this parameter to be True to produce hierarchical series.\n",
      " |            It stops the recursion at an early level and may provide nicer\n",
      " |            and more useful results.\n",
      " |      \n",
      " |      bound : Value, Integer\n",
      " |              Use the ``bound`` parameter to give limit on rewriting\n",
      " |              coefficients in its normalised form.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, exp\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> e = sin(1/x + exp(-x)) - sin(1/x)\n",
      " |      \n",
      " |      >>> e.aseries(x)\n",
      " |      (1/(24*x**4) - 1/(2*x**2) + 1 + O(x**(-6), (x, oo)))*exp(-x)\n",
      " |      \n",
      " |      >>> e.aseries(x, n=3, hir=True)\n",
      " |      -exp(-2*x)*sin(1/x)/2 + exp(-x)*cos(1/x) + O(exp(-3*x), (x, oo))\n",
      " |      \n",
      " |      >>> e = exp(exp(x)/(1 - 1/x))\n",
      " |      \n",
      " |      >>> e.aseries(x)\n",
      " |      exp(exp(x)/(1 - 1/x))\n",
      " |      \n",
      " |      >>> e.aseries(x, bound=3) # doctest: +SKIP\n",
      " |      exp(exp(x)/x**2)*exp(exp(x)/x)*exp(-exp(x) + exp(x)/(1 - 1/x) - exp(x)/x - exp(x)/x**2)*exp(exp(x))\n",
      " |      \n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).aseries(x, n=8)\n",
      " |      1/x\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      Expr\n",
      " |          Asymptotic series expansion of the expression.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      This algorithm is directly induced from the limit computational algorithm provided by Gruntz.\n",
      " |      It majorly uses the mrv and rewrite sub-routines. The overall idea of this algorithm is first\n",
      " |      to look for the most rapidly varying subexpression w of a given expression f and then expands f\n",
      " |      in a series in w. Then same thing is recursively done on the leading coefficient\n",
      " |      till we get constant coefficients.\n",
      " |      \n",
      " |      If the most rapidly varying subexpression of a given expression f is f itself,\n",
      " |      the algorithm tries to find a normalised representation of the mrv set and rewrites f\n",
      " |      using this normalised representation.\n",
      " |      \n",
      " |      If the expansion contains an order term, it will be either ``O(x ** (-n))`` or ``O(w ** (-n))``\n",
      " |      where ``w`` belongs to the most rapidly varying expression of ``self``.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] Gruntz, Dominik. A new algorithm for computing asymptotic series.\n",
      " |             In: Proc. 1993 Int. Symp. Symbolic and Algebraic Computation. 1993.\n",
      " |             pp. 239-244.\n",
      " |      .. [2] Gruntz thesis - p90\n",
      " |      .. [3] https://en.wikipedia.org/wiki/Asymptotic_expansion\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      Expr.aseries: See the docstring of this function for complete details of this wrapper.\n",
      " |  \n",
      " |  cancel(self, *gens, **args)\n",
      " |      See the cancel function in sympy.polys\n",
      " |  \n",
      " |  coeff(self, x, n=1, right=False, _first=True)\n",
      " |      Returns the coefficient from the term(s) containing ``x**n``. If ``n``\n",
      " |      is zero then all terms independent of ``x`` will be returned.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      When ``x`` is noncommutative, the coefficient to the left (default) or\n",
      " |      right of ``x`` can be returned. The keyword 'right' is ignored when\n",
      " |      ``x`` is commutative.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      \n",
      " |      You can select terms that have an explicit negative in front of them:\n",
      " |      \n",
      " |      >>> (-x + 2*y).coeff(-1)\n",
      " |      x\n",
      " |      >>> (x - 2*y).coeff(-1)\n",
      " |      2*y\n",
      " |      \n",
      " |      You can select terms with no Rational coefficient:\n",
      " |      \n",
      " |      >>> (x + 2*y).coeff(1)\n",
      " |      x\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(1)\n",
      " |      0\n",
      " |      \n",
      " |      You can select terms independent of x by making n=0; in this case\n",
      " |      expr.as_independent(x)[0] is returned (and 0 will be returned instead\n",
      " |      of None):\n",
      " |      \n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x, 0)\n",
      " |      3\n",
      " |      >>> eq = ((x + 1)**3).expand() + 1\n",
      " |      >>> eq\n",
      " |      x**3 + 3*x**2 + 3*x + 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 2]\n",
      " |      >>> eq -= 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 0]\n",
      " |      \n",
      " |      You can select terms that have a numerical term in front of them:\n",
      " |      \n",
      " |      >>> (-x - 2*y).coeff(2)\n",
      " |      -y\n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> (x + sqrt(2)*x).coeff(sqrt(2))\n",
      " |      x\n",
      " |      \n",
      " |      The matching is exact:\n",
      " |      \n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x)\n",
      " |      2\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**2)\n",
      " |      4\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**3)\n",
      " |      0\n",
      " |      >>> (z*(x + y)**2).coeff((x + y)**2)\n",
      " |      z\n",
      " |      >>> (z*(x + y)**2).coeff(x + y)\n",
      " |      0\n",
      " |      \n",
      " |      In addition, no factoring is done, so 1 + z*(1 + y) is not obtained\n",
      " |      from the following:\n",
      " |      \n",
      " |      >>> (x + z*(x + x*y)).coeff(x)\n",
      " |      1\n",
      " |      \n",
      " |      If such factoring is desired, factor_terms can be used first:\n",
      " |      \n",
      " |      >>> from sympy import factor_terms\n",
      " |      >>> factor_terms(x + z*(x + x*y)).coeff(x)\n",
      " |      z*(y + 1) + 1\n",
      " |      \n",
      " |      >>> n, m, o = symbols('n m o', commutative=False)\n",
      " |      >>> n.coeff(n)\n",
      " |      1\n",
      " |      >>> (3*n).coeff(n)\n",
      " |      3\n",
      " |      >>> (n*m + m*n*m).coeff(n) # = (1 + m)*n*m\n",
      " |      1 + m\n",
      " |      >>> (n*m + m*n*m).coeff(n, right=True) # = (1 + m)*n*m\n",
      " |      m\n",
      " |      \n",
      " |      If there is more than one possible coefficient 0 is returned:\n",
      " |      \n",
      " |      >>> (n*m + m*n).coeff(n)\n",
      " |      0\n",
      " |      \n",
      " |      If there is only one possible coefficient, it is returned:\n",
      " |      \n",
      " |      >>> (n*m + x*m*n).coeff(m*n)\n",
      " |      x\n",
      " |      >>> (n*m + x*m*n).coeff(m*n, right=1)\n",
      " |      1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      as_coefficient: separate the expression into a coefficient and factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |  \n",
      " |  collect(self, syms, func=None, evaluate=True, exact=False, distribute_order_term=True)\n",
      " |      See the collect function in sympy.simplify\n",
      " |  \n",
      " |  combsimp(self)\n",
      " |      See the combsimp function in sympy.simplify\n",
      " |  \n",
      " |  compute_leading_term(self, x, logx=None)\n",
      " |      Deprecated function to compute the leading term of a series.\n",
      " |      \n",
      " |      as_leading_term is only allowed for results of .series()\n",
      " |      This is a wrapper to compute a series first.\n",
      " |  \n",
      " |  conjugate(self)\n",
      " |      Returns the complex conjugate of 'self'.\n",
      " |  \n",
      " |  could_extract_minus_sign(self)\n",
      " |      Return True if self has -1 as a leading factor or has\n",
      " |      more literal negative signs than positive signs in a sum,\n",
      " |      otherwise False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = x - y\n",
      " |      >>> {i.could_extract_minus_sign() for i in (e, -e)}\n",
      " |      {False, True}\n",
      " |      \n",
      " |      Though the ``y - x`` is considered like ``-(x - y)``, since it\n",
      " |      is in a product without a leading factor of -1, the result is\n",
      " |      false below:\n",
      " |      \n",
      " |      >>> (x*(y - x)).could_extract_minus_sign()\n",
      " |      False\n",
      " |      \n",
      " |      To put something in canonical form wrt to sign, use `signsimp`:\n",
      " |      \n",
      " |      >>> from sympy import signsimp\n",
      " |      >>> signsimp(x*(y - x))\n",
      " |      -x*(x - y)\n",
      " |      >>> _.could_extract_minus_sign()\n",
      " |      True\n",
      " |  \n",
      " |  count_ops(self, visual=None)\n",
      " |      Wrapper for count_ops that returns the operation count.\n",
      " |  \n",
      " |  diff(self, *symbols, **assumptions)\n",
      " |  \n",
      " |  dir(self, x, cdir)\n",
      " |  \n",
      " |  equals(self, other, failing_expression=False)\n",
      " |      Return True if self == other, False if it does not, or None. If\n",
      " |      failing_expression is True then the expression which did not simplify\n",
      " |      to a 0 will be returned instead of None.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      If ``self`` is a Number (or complex number) that is not zero, then\n",
      " |      the result is False.\n",
      " |      \n",
      " |      If ``self`` is a number and has not evaluated to zero, evalf will be\n",
      " |      used to test whether the expression evaluates to zero. If it does so\n",
      " |      and the result has significance (i.e. the precision is either -1, for\n",
      " |      a Rational result, or is greater than 1) then the evalf value will be\n",
      " |      used to return True or False.\n",
      " |  \n",
      " |  expand(self, deep=True, modulus=None, power_base=True, power_exp=True, mul=True, log=True, multinomial=True, basic=True, **hints)\n",
      " |      Expand an expression using hints.\n",
      " |      \n",
      " |      See the docstring of the expand() function in sympy.core.function for\n",
      " |      more information.\n",
      " |  \n",
      " |  extract_additively(self, c)\n",
      " |      Return self - c if it's possible to subtract c from self and\n",
      " |      make all matching coefficients move towards zero, else return None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = 2*x + 3\n",
      " |      >>> e.extract_additively(x + 1)\n",
      " |      x + 2\n",
      " |      >>> e.extract_additively(3*x)\n",
      " |      >>> e.extract_additively(4)\n",
      " |      >>> (y*(x + 1)).extract_additively(x + 1)\n",
      " |      >>> ((x + 1)*(x + 2*y + 1) + 3).extract_additively(x + 1)\n",
      " |      (x + 1)*(x + 2*y) + 3\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      extract_multiplicatively\n",
      " |      coeff\n",
      " |      as_coefficient\n",
      " |  \n",
      " |  extract_branch_factor(self, allow_half=False)\n",
      " |      Try to write self as ``exp_polar(2*pi*I*n)*z`` in a nice way.\n",
      " |      Return (z, n).\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, I, pi\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> exp_polar(I*pi).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), 0)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor()\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(-pi*I).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), -1)\n",
      " |      >>> exp_polar(3*pi*I + x).extract_branch_factor()\n",
      " |      (exp_polar(x + I*pi), 1)\n",
      " |      >>> (y*exp_polar(-5*pi*I)*exp_polar(3*pi*I + 2*pi*x)).extract_branch_factor()\n",
      " |      (y*exp_polar(2*pi*x), -1)\n",
      " |      >>> exp_polar(-I*pi/2).extract_branch_factor()\n",
      " |      (exp_polar(-I*pi/2), 0)\n",
      " |      \n",
      " |      If allow_half is True, also extract exp_polar(I*pi):\n",
      " |      \n",
      " |      >>> exp_polar(I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1/2)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(3*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 3/2)\n",
      " |      >>> exp_polar(-I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, -1/2)\n",
      " |  \n",
      " |  extract_multiplicatively(self, c)\n",
      " |      Return None if it's not possible to make self in the form\n",
      " |      c * something in a nice way, i.e. preserving the properties\n",
      " |      of arguments of self.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Rational\n",
      " |      \n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |      \n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**2 * y)\n",
      " |      x*y**2\n",
      " |      \n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**4 * y)\n",
      " |      \n",
      " |      >>> (2*x).extract_multiplicatively(2)\n",
      " |      x\n",
      " |      \n",
      " |      >>> (2*x).extract_multiplicatively(3)\n",
      " |      \n",
      " |      >>> (Rational(1, 2)*x).extract_multiplicatively(3)\n",
      " |      x/6\n",
      " |  \n",
      " |  factor(self, *gens, **args)\n",
      " |      See the factor() function in sympy.polys.polytools\n",
      " |  \n",
      " |  fourier_series(self, limits=None)\n",
      " |      Compute fourier sine/cosine series of self.\n",
      " |      \n",
      " |      See the docstring of the :func:`fourier_series` in sympy.series.fourier\n",
      " |      for more information.\n",
      " |  \n",
      " |  fps(self, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False)\n",
      " |      Compute formal power power series of self.\n",
      " |      \n",
      " |      See the docstring of the :func:`fps` function in sympy.series.formal for\n",
      " |      more information.\n",
      " |  \n",
      " |  gammasimp(self)\n",
      " |      See the gammasimp function in sympy.simplify\n",
      " |  \n",
      " |  getO(self)\n",
      " |      Returns the additive O(..) symbol if there is one, else None.\n",
      " |  \n",
      " |  getn(self)\n",
      " |      Returns the order of the expression.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      The order is determined either from the O(...) term. If there\n",
      " |      is no O(...) term, it returns None.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import O\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + O(x**2)).getn()\n",
      " |      2\n",
      " |      >>> (1 + x).getn()\n",
      " |  \n",
      " |  integrate(self, *args, **kwargs)\n",
      " |      See the integrate function in sympy.integrals\n",
      " |  \n",
      " |  invert(self, g, *gens, **args)\n",
      " |      Return the multiplicative inverse of ``self`` mod ``g``\n",
      " |      where ``self`` (and ``g``) may be symbolic expressions).\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      sympy.core.numbers.mod_inverse, sympy.polys.polytools.invert\n",
      " |  \n",
      " |  is_algebraic_expr(self, *syms)\n",
      " |      This tests whether a given expression is algebraic or not, in the\n",
      " |      given symbols, syms. When syms is not given, all free symbols\n",
      " |      will be used. The rational function does not have to be in expanded\n",
      " |      or in any kind of canonical form.\n",
      " |      \n",
      " |      This function returns False for expressions that are \"algebraic\n",
      " |      expressions\" with symbolic exponents. This is a simple extension to the\n",
      " |      is_rational_function, including rational exponentiation.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, sqrt\n",
      " |      >>> x = Symbol('x', real=True)\n",
      " |      >>> sqrt(1 + x).is_rational_function()\n",
      " |      False\n",
      " |      >>> sqrt(1 + x).is_algebraic_expr()\n",
      " |      True\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be an algebraic\n",
      " |      expression to become one.\n",
      " |      \n",
      " |      >>> from sympy import exp, factor\n",
      " |      >>> a = sqrt(exp(x)**2 + 2*exp(x) + 1)/(exp(x) + 1)\n",
      " |      >>> a.is_algebraic_expr(x)\n",
      " |      False\n",
      " |      >>> factor(a).is_algebraic_expr()\n",
      " |      True\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      is_rational_function\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Algebraic_expression\n",
      " |  \n",
      " |  is_constant(self, *wrt, **flags)\n",
      " |      Return True if self is constant, False if not, or None if\n",
      " |      the constancy could not be determined conclusively.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      If an expression has no free symbols then it is a constant. If\n",
      " |      there are free symbols it is possible that the expression is a\n",
      " |      constant, perhaps (but not necessarily) zero. To test such\n",
      " |      expressions, a few strategies are tried:\n",
      " |      \n",
      " |      1) numerical evaluation at two random points. If two such evaluations\n",
      " |      give two different values and the values have a precision greater than\n",
      " |      1 then self is not constant. If the evaluations agree or could not be\n",
      " |      obtained with any precision, no decision is made. The numerical testing\n",
      " |      is done only if ``wrt`` is different than the free symbols.\n",
      " |      \n",
      " |      2) differentiation with respect to variables in 'wrt' (or all free\n",
      " |      symbols if omitted) to see if the expression is constant or not. This\n",
      " |      will not always lead to an expression that is zero even though an\n",
      " |      expression is constant (see added test in test_expr.py). If\n",
      " |      all derivatives are zero then self is constant with respect to the\n",
      " |      given symbols.\n",
      " |      \n",
      " |      3) finding out zeros of denominator expression with free_symbols.\n",
      " |      It will not be constant if there are zeros. It gives more negative\n",
      " |      answers for expression that are not constant.\n",
      " |      \n",
      " |      If neither evaluation nor differentiation can prove the expression is\n",
      " |      constant, None is returned unless two numerical values happened to be\n",
      " |      the same and the flag ``failing_number`` is True -- in that case the\n",
      " |      numerical value will be returned.\n",
      " |      \n",
      " |      If flag simplify=False is passed, self will not be simplified;\n",
      " |      the default is True since self should be simplified before testing.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, Sum, S, pi\n",
      " |      >>> from sympy.abc import a, n, x, y\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> S(2).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, 10)).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant()\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(y)\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(n)\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(x)\n",
      " |      True\n",
      " |      >>> eq = a*cos(x)**2 + a*sin(x)**2 - a\n",
      " |      >>> eq.is_constant()\n",
      " |      True\n",
      " |      >>> eq.subs({x: pi, a: 2}) == eq.subs({x: pi, a: 3}) == 0\n",
      " |      True\n",
      " |      \n",
      " |      >>> (0**x).is_constant()\n",
      " |      False\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> (x**x).is_constant()\n",
      " |      False\n",
      " |      >>> one = cos(x)**2 + sin(x)**2\n",
      " |      >>> one.is_constant()\n",
      " |      True\n",
      " |      >>> ((one - 1)**(x + 1)).is_constant() in (True, False) # could be 0 or 1\n",
      " |      True\n",
      " |  \n",
      " |  is_meromorphic(self, x, a)\n",
      " |      This tests whether an expression is meromorphic as\n",
      " |      a function of the given symbol ``x`` at the point ``a``.\n",
      " |      \n",
      " |      This method is intended as a quick test that will return\n",
      " |      None if no decision can be made without simplification or\n",
      " |      more detailed analysis.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import zoo, log, sin, sqrt\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> f = 1/x**2 + 1 - 2*x**3\n",
      " |      >>> f.is_meromorphic(x, 0)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |      \n",
      " |      >>> g = x**log(3)\n",
      " |      >>> g.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> g.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> g.is_meromorphic(x, zoo)\n",
      " |      False\n",
      " |      \n",
      " |      >>> h = sin(1/x)*x**2\n",
      " |      >>> h.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> h.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> h.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |      \n",
      " |      Multivalued functions are considered meromorphic when their\n",
      " |      branches are meromorphic. Thus most functions are meromorphic\n",
      " |      everywhere except at essential singularities and branch points.\n",
      " |      In particular, they will be meromorphic also on branch cuts\n",
      " |      except at their endpoints.\n",
      " |      \n",
      " |      >>> log(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> log(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> sqrt(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> sqrt(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |  \n",
      " |  is_polynomial(self, *syms)\n",
      " |      Return True if self is a polynomial in syms and False otherwise.\n",
      " |      \n",
      " |      This checks if self is an exact polynomial in syms.  This function\n",
      " |      returns False for expressions that are \"polynomials\" with symbolic\n",
      " |      exponents.  Thus, you should be able to apply polynomial algorithms to\n",
      " |      expressions for which this returns True, and Poly(expr, \\*syms) should\n",
      " |      work if and only if expr.is_polynomial(\\*syms) returns True. The\n",
      " |      polynomial does not have to be in expanded form.  If no symbols are\n",
      " |      given, all free symbols in the expression will be used.\n",
      " |      \n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', polynomial=True).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, Function\n",
      " |      >>> x = Symbol('x')\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial(x)\n",
      " |      True\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial()\n",
      " |      True\n",
      " |      >>> (2**x + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (2**x + 1).is_polynomial(2**x)\n",
      " |      True\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (f(x) + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (f(x) + 1).is_polynomial(f(x))\n",
      " |      True\n",
      " |      >>> (1/f(x) + 1).is_polynomial(f(x))\n",
      " |      False\n",
      " |      \n",
      " |      >>> n = Symbol('n', nonnegative=True, integer=True)\n",
      " |      >>> (x**n + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a polynomial to\n",
      " |      become one.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, factor, cancel\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)\n",
      " |      >>> a.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      y + 1\n",
      " |      >>> factor(a).is_polynomial(y)\n",
      " |      True\n",
      " |      \n",
      " |      >>> b = (y**2 + 2*y + 1)/(y + 1)\n",
      " |      >>> b.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> cancel(b)\n",
      " |      y + 1\n",
      " |      >>> cancel(b).is_polynomial(y)\n",
      " |      True\n",
      " |      \n",
      " |      See also .is_rational_function()\n",
      " |  \n",
      " |  is_rational_function(self, *syms)\n",
      " |      Test whether function is a ratio of two polynomials in the given\n",
      " |      symbols, syms. When syms is not given, all free symbols will be used.\n",
      " |      The rational function does not have to be in expanded or in any kind of\n",
      " |      canonical form.\n",
      " |      \n",
      " |      This function returns False for expressions that are \"rational\n",
      " |      functions\" with symbolic exponents.  Thus, you should be able to call\n",
      " |      .as_numer_denom() and apply polynomial algorithms to the result for\n",
      " |      expressions for which this returns True.\n",
      " |      \n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', rational_function=True).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> (x/y).is_rational_function()\n",
      " |      True\n",
      " |      \n",
      " |      >>> (x**2).is_rational_function()\n",
      " |      True\n",
      " |      \n",
      " |      >>> (x/sin(y)).is_rational_function(y)\n",
      " |      False\n",
      " |      \n",
      " |      >>> n = Symbol('n', integer=True)\n",
      " |      >>> (x**n + 1).is_rational_function(x)\n",
      " |      False\n",
      " |      \n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a rational function\n",
      " |      to become one.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, factor\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)/y\n",
      " |      >>> a.is_rational_function(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      (y + 1)/y\n",
      " |      >>> factor(a).is_rational_function(y)\n",
      " |      True\n",
      " |      \n",
      " |      See also is_algebraic_expr().\n",
      " |  \n",
      " |  leadterm(self, x, logx=None, cdir=0)\n",
      " |      Returns the leading term a*x**b as a tuple (a, b).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1+x+x**2).leadterm(x)\n",
      " |      (1, 0)\n",
      " |      >>> (1/x**2+x+x**2).leadterm(x)\n",
      " |      (1, -2)\n",
      " |  \n",
      " |  limit(self, x, xlim, dir='+')\n",
      " |      Compute limit x->xlim.\n",
      " |  \n",
      " |  lseries(self, x=None, x0=0, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper for series yielding an iterator of the terms of the series.\n",
      " |      \n",
      " |      Note: an infinite series will yield an infinite iterator. The following,\n",
      " |      for exaxmple, will never terminate. It will just keep printing terms\n",
      " |      of the sin(x) series::\n",
      " |      \n",
      " |        for term in sin(x).lseries(x):\n",
      " |            print term\n",
      " |      \n",
      " |      The advantage of lseries() over nseries() is that many times you are\n",
      " |      just interested in the next term in the series (i.e. the first term for\n",
      " |      example), but you do not know how many you should ask for in nseries()\n",
      " |      using the \"n\" parameter.\n",
      " |      \n",
      " |      See also nseries().\n",
      " |  \n",
      " |  normal(self)\n",
      " |      Return the expression as a fraction.\n",
      " |      \n",
      " |      expression -> a/b\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      as_numer_denom: return ``(a, b)`` instead of ``a/b``\n",
      " |  \n",
      " |  nseries(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper to _eval_nseries if assumptions allow, else to series.\n",
      " |      \n",
      " |      If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is\n",
      " |      called. This calculates \"n\" terms in the innermost expressions and\n",
      " |      then builds up the final series just by \"cross-multiplying\" everything\n",
      " |      out.\n",
      " |      \n",
      " |      The optional ``logx`` parameter can be used to replace any log(x) in the\n",
      " |      returned series with a symbolic value to avoid evaluating log(x) at 0. A\n",
      " |      symbol to use in place of log(x) should be provided.\n",
      " |      \n",
      " |      Advantage -- it's fast, because we do not have to determine how many\n",
      " |      terms we need to calculate in advance.\n",
      " |      \n",
      " |      Disadvantage -- you may end up with less terms than you may have\n",
      " |      expected, but the O(x**n) term appended will always be correct and\n",
      " |      so the result, though perhaps shorter, will also be correct.\n",
      " |      \n",
      " |      If any of those assumptions is not met, this is treated like a\n",
      " |      wrapper to series which will try harder to return the correct\n",
      " |      number of terms.\n",
      " |      \n",
      " |      See also lseries().\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin, log, Symbol\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> sin(x).nseries(x, 0, 6)\n",
      " |      x - x**3/6 + x**5/120 + O(x**6)\n",
      " |      >>> log(x+1).nseries(x, 0, 5)\n",
      " |      x - x**2/2 + x**3/3 - x**4/4 + O(x**5)\n",
      " |      \n",
      " |      Handling of the ``logx`` parameter --- in the following example the\n",
      " |      expansion fails since ``sin`` does not have an asymptotic expansion\n",
      " |      at -oo (the limit of log(x) as x approaches 0):\n",
      " |      \n",
      " |      >>> e = sin(log(x))\n",
      " |      >>> e.nseries(x, 0, 6)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      PoleError: ...\n",
      " |      ...\n",
      " |      >>> logx = Symbol('logx')\n",
      " |      >>> e.nseries(x, 0, 6, logx=logx)\n",
      " |      sin(logx)\n",
      " |      \n",
      " |      In the following example, the expansion works but only returns self\n",
      " |      unless the ``logx`` parameter is used:\n",
      " |      \n",
      " |      >>> e = x**y\n",
      " |      >>> e.nseries(x, 0, 2)\n",
      " |      x**y\n",
      " |      >>> e.nseries(x, 0, 2, logx=logx)\n",
      " |      exp(logx*y)\n",
      " |  \n",
      " |  nsimplify(self, constants=(), tolerance=None, full=False)\n",
      " |      See the nsimplify function in sympy.simplify\n",
      " |  \n",
      " |  powsimp(self, *args, **kwargs)\n",
      " |      See the powsimp function in sympy.simplify\n",
      " |  \n",
      " |  primitive(self)\n",
      " |      Return the positive Rational that can be extracted non-recursively\n",
      " |      from every term of self (i.e., self is treated like an Add). This is\n",
      " |      like the as_coeff_Mul() method but primitive always extracts a positive\n",
      " |      Rational (never a negative or a Float).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (3*(x + 1)**2).primitive()\n",
      " |      (3, (x + 1)**2)\n",
      " |      >>> a = (6*x + 2); a.primitive()\n",
      " |      (2, 3*x + 1)\n",
      " |      >>> b = (x/2 + 3); b.primitive()\n",
      " |      (1/2, x + 6)\n",
      " |      >>> (a*b).primitive() == (1, a*b)\n",
      " |      True\n",
      " |  \n",
      " |  radsimp(self, **kwargs)\n",
      " |      See the radsimp function in sympy.simplify\n",
      " |  \n",
      " |  ratsimp(self)\n",
      " |      See the ratsimp function in sympy.simplify\n",
      " |  \n",
      " |  removeO(self)\n",
      " |      Removes the additive O(..) symbol if there is one\n",
      " |  \n",
      " |  round(self, n=None)\n",
      " |      Return x rounded to the given decimal place.\n",
      " |      \n",
      " |      If a complex number would results, apply round to the real\n",
      " |      and imaginary components of the number.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, E, I, S, Number\n",
      " |      >>> pi.round()\n",
      " |      3\n",
      " |      >>> pi.round(2)\n",
      " |      3.14\n",
      " |      >>> (2*pi + E*I).round()\n",
      " |      6 + 3*I\n",
      " |      \n",
      " |      The round method has a chopping effect:\n",
      " |      \n",
      " |      >>> (2*pi + I/10).round()\n",
      " |      6\n",
      " |      >>> (pi/10 + 2*I).round()\n",
      " |      2*I\n",
      " |      >>> (pi/10 + E*I).round(2)\n",
      " |      0.31 + 2.72*I\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      The Python ``round`` function uses the SymPy ``round`` method so it\n",
      " |      will always return a SymPy number (not a Python float or int):\n",
      " |      \n",
      " |      >>> isinstance(round(S(123), -2), Number)\n",
      " |      True\n",
      " |  \n",
      " |  separate(self, deep=False, force=False)\n",
      " |      See the separate function in sympy.simplify\n",
      " |  \n",
      " |  series(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Series expansion of \"self\" around ``x = x0`` yielding either terms of\n",
      " |      the series one by one (the lazy series given when n=None), else\n",
      " |      all the terms at once when n != None.\n",
      " |      \n",
      " |      Returns the series expansion of \"self\" around the point ``x = x0``\n",
      " |      with respect to ``x`` up to ``O((x - x0)**n, x, x0)`` (default n is 6).\n",
      " |      \n",
      " |      If ``x=None`` and ``self`` is univariate, the univariate symbol will\n",
      " |      be supplied, otherwise an error will be raised.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      expr : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |      \n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |      \n",
      " |      x0 : Value\n",
      " |           The value around which ``x`` is calculated. Can be any value\n",
      " |           from ``-oo`` to ``oo``.\n",
      " |      \n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |      \n",
      " |      dir : String, optional\n",
      " |            The series-expansion can be bi-directional. If ``dir=\"+\"``,\n",
      " |            then (x->x0+). If ``dir=\"-\", then (x->x0-). For infinite\n",
      " |            ``x0`` (``oo`` or ``-oo``), the ``dir`` argument is determined\n",
      " |            from the direction of the infinity (i.e., ``dir=\"-\"`` for\n",
      " |            ``oo``).\n",
      " |      \n",
      " |      logx : optional\n",
      " |             It is used to replace any log(x) in the returned series with a\n",
      " |             symbolic value rather than evaluating the actual value.\n",
      " |      \n",
      " |      cdir : optional\n",
      " |             It stands for complex direction, and indicates the direction\n",
      " |             from which the expansion needs to be evaluated.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cos, exp, tan\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> cos(x).series()\n",
      " |      1 - x**2/2 + x**4/24 + O(x**6)\n",
      " |      >>> cos(x).series(n=4)\n",
      " |      1 - x**2/2 + O(x**4)\n",
      " |      >>> cos(x).series(x, x0=1, n=2)\n",
      " |      cos(1) - (x - 1)*sin(1) + O((x - 1)**2, (x, 1))\n",
      " |      >>> e = cos(x + exp(y))\n",
      " |      >>> e.series(y, n=2)\n",
      " |      cos(x + 1) - y*sin(x + 1) + O(y**2)\n",
      " |      >>> e.series(x, n=2)\n",
      " |      cos(exp(y)) - x*sin(exp(y)) + O(x**2)\n",
      " |      \n",
      " |      If ``n=None`` then a generator of the series terms will be returned.\n",
      " |      \n",
      " |      >>> term=cos(x).series(n=None)\n",
      " |      >>> [next(term) for i in range(2)]\n",
      " |      [1, -x**2/2]\n",
      " |      \n",
      " |      For ``dir=+`` (default) the series is calculated from the right and\n",
      " |      for ``dir=-`` the series from the left. For smooth functions this\n",
      " |      flag will not alter the results.\n",
      " |      \n",
      " |      >>> abs(x).series(dir=\"+\")\n",
      " |      x\n",
      " |      >>> abs(x).series(dir=\"-\")\n",
      " |      -x\n",
      " |      >>> f = tan(x)\n",
      " |      >>> f.series(x, 2, 6, \"+\")\n",
      " |      tan(2) + (1 + tan(2)**2)*(x - 2) + (x - 2)**2*(tan(2)**3 + tan(2)) +\n",
      " |      (x - 2)**3*(1/3 + 4*tan(2)**2/3 + tan(2)**4) + (x - 2)**4*(tan(2)**5 +\n",
      " |      5*tan(2)**3/3 + 2*tan(2)/3) + (x - 2)**5*(2/15 + 17*tan(2)**2/15 +\n",
      " |      2*tan(2)**4 + tan(2)**6) + O((x - 2)**6, (x, 2))\n",
      " |      \n",
      " |      >>> f.series(x, 2, 3, \"-\")\n",
      " |      tan(2) + (2 - x)*(-tan(2)**2 - 1) + (2 - x)**2*(tan(2)**3 + tan(2))\n",
      " |      + O((x - 2)**3, (x, 2))\n",
      " |      \n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).series(x, n=8)\n",
      " |      1/x\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      Expr : Expression\n",
      " |          Series expansion of the expression about x0\n",
      " |      \n",
      " |      Raises\n",
      " |      ======\n",
      " |      \n",
      " |      TypeError\n",
      " |          If \"n\" and \"x0\" are infinity objects\n",
      " |      \n",
      " |      PoleError\n",
      " |          If \"x0\" is an infinity object\n",
      " |  \n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import S, I\n",
      " |      \n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |      \n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |  \n",
      " |  taylor_term(self, n, x, *previous_terms)\n",
      " |      General method for the taylor term.\n",
      " |      \n",
      " |      This method is slow, because it differentiates n-times. Subclasses can\n",
      " |      redefine it to make it faster by using the \"previous_terms\".\n",
      " |  \n",
      " |  together(self, *args, **kwargs)\n",
      " |      See the together function in sympy.polys\n",
      " |  \n",
      " |  transpose(self)\n",
      " |  \n",
      " |  trigsimp(self, **args)\n",
      " |      See the trigsimp function in sympy.simplify\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  expr_free_symbols\n",
      " |      Like ``free_symbols``, but returns the free symbols only if\n",
      " |      they are contained in an expression node.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (x + y).expr_free_symbols # doctest: +SKIP\n",
      " |      {x, y}\n",
      " |      \n",
      " |      If the expression is contained in a non-expression object, do not return\n",
      " |      the free symbols. Compare:\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> t = Tuple(x + y)\n",
      " |      >>> t.expr_free_symbols # doctest: +SKIP\n",
      " |      set()\n",
      " |      >>> t.free_symbols\n",
      " |      {x, y}\n",
      " |  \n",
      " |  is_number\n",
      " |      Returns True if ``self`` has no free symbols and no\n",
      " |      undefined functions (AppliedUndef, to be precise). It will be\n",
      " |      faster than ``if not self.free_symbols``, however, since\n",
      " |      ``is_number`` will fail as soon as it hits a free symbol\n",
      " |      or undefined function.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Function, Integral, cos, sin, pi\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> f = Function('f')\n",
      " |      \n",
      " |      >>> x.is_number\n",
      " |      False\n",
      " |      >>> f(1).is_number\n",
      " |      False\n",
      " |      >>> (2*x).is_number\n",
      " |      False\n",
      " |      >>> (2 + Integral(2, x)).is_number\n",
      " |      False\n",
      " |      >>> (2 + Integral(2, (x, 1, 2))).is_number\n",
      " |      True\n",
      " |      \n",
      " |      Not all numbers are Numbers in the SymPy sense:\n",
      " |      \n",
      " |      >>> pi.is_number, pi.is_Number\n",
      " |      (True, False)\n",
      " |      \n",
      " |      If something is a number it should evaluate to a number with\n",
      " |      real and imaginary parts that are Numbers; the result may not\n",
      " |      be comparable, however, since the real and/or imaginary part\n",
      " |      of the result may not have precision.\n",
      " |      \n",
      " |      >>> cos(1).is_number and cos(1).is_comparable\n",
      " |      True\n",
      " |      \n",
      " |      >>> z = cos(1)**2 + sin(1)**2 - 1\n",
      " |      >>> z.is_number\n",
      " |      True\n",
      " |      >>> z.is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.core.basic.Basic.is_comparable\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.expr.Expr:\n",
      " |  \n",
      " |  is_scalar = True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |      \n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      from https://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |  \n",
      " |  __getnewargs__(self)\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __hash__(self) -> 'int'\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __ne__(self, other)\n",
      " |      ``a != b``  -> Compare two symbolic trees and see whether they are different\n",
      " |      \n",
      " |      this is the same as:\n",
      " |      \n",
      " |      ``a.compare(b) != 0``\n",
      " |      \n",
      " |      but faster\n",
      " |  \n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |  \n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |      \n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |      \n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |      \n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |      \n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |      \n",
      " |      The type can be given implicitly, too:\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |      \n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |      \n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |  \n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |      \n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |  \n",
      " |  copy(self)\n",
      " |  \n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |  \n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |  \n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> u = Dummy('u')\n",
      " |      \n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |      \n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |  \n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |  \n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |      \n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |      \n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |      \n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |      \n",
      " |      \n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |      \n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |  \n",
      " |  has_free(self, *patterns)\n",
      " |      Return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |      \n",
      " |      This works for subexpressions and types, too:\n",
      " |      \n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |  \n",
      " |  has_xfree(self, s: 'set[Basic]')\n",
      " |      Return True if self has any of the patterns in s as a\n",
      " |      free argument, else False. This is like `Basic.has_free`\n",
      " |      but this will only report exact argument matches.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> f(x).has_xfree({f})\n",
      " |      False\n",
      " |      >>> f(x).has_xfree({f(x)})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x + 1})\n",
      " |      True\n",
      " |      >>> f(x + y + 1).has_xfree({x + 1})\n",
      " |      False\n",
      " |  \n",
      " |  is_hypergeometric(self, k)\n",
      " |  \n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |      \n",
      " |      Wild symbols match all.\n",
      " |      \n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |      \n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |      \n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |      \n",
      " |      But they can be identified if desired:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |      \n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |      \n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |  \n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |  \n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |      \n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |      \n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |      \n",
      " |      however, you can use:\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |  \n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |  \n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |      \n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself does not match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |      \n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |      \n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |      \n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      Initial setup\n",
      " |      \n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |      \n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |      \n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |      \n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |      \n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |      \n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |      \n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |      \n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |      \n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |      \n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |      \n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |      \n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |      \n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |      \n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |      \n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |      \n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |      \n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |      \n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |      \n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |      \n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |      \n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |      \n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |      \n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |      \n",
      " |      Here, we want `exact=False`:\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |      \n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |      \n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |      \n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |      \n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |  \n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |      \n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |      \n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      args : Expr\n",
      " |          A *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |      \n",
      " |      deep : bool, optional\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |      \n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |      \n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |      \n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |      \n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |  \n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |  \n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |      \n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |      \n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |      \n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |      \n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |      \n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |      \n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |      \n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |      \n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |      \n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |      \n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |      \n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |      \n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |      \n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |      \n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |      \n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |      \n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |      \n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |      \n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |      \n",
      " |      rather than\n",
      " |      \n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |      \n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |  \n",
      " |  xreplace lambda rule, **_\n",
      " |      # Function needs args so we define a property that returns\n",
      " |      # a function that takes args...and then use that function\n",
      " |      # to return the right value\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __init_subclass__() from sympy.core.function.FunctionClass\n",
      " |      This method is called when a class is subclassed.\n",
      " |      \n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |  \n",
      " |  fromiter(args, **assumptions) from sympy.core.function.FunctionClass\n",
      " |      Create a new object from an iterable.\n",
      " |      \n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __sympy__\n",
      " |  \n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |      \n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |      \n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Do not override .args() from Basic (so that it is easy to\n",
      " |      change the interface in the future if needed).\n",
      " |  \n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |      \n",
      " |      For example:\n",
      " |      \n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |      \n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |  \n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |  \n",
      " |  free_symbols\n",
      " |      Return from the atoms of self those which are free symbols.\n",
      " |      \n",
      " |      Not all free symbols are ``Symbol``. Eg: IndexedBase('I')[0].free_symbols\n",
      " |      \n",
      " |      For most expressions, all symbols are free symbols. For some classes\n",
      " |      this is not true. e.g. Integrals use Symbols for the dummy variables\n",
      " |      which are bound variables, so Integral has a method to return all\n",
      " |      symbols except those. Derivative keeps track of symbols with respect\n",
      " |      to which it will perform a derivative; those are\n",
      " |      bound variables, too, so it has its own free_symbols method.\n",
      " |      \n",
      " |      Any other method that uses bound variables should implement a\n",
      " |      free_symbols method.\n",
      " |  \n",
      " |  is_algebraic\n",
      " |  \n",
      " |  is_antihermitian\n",
      " |  \n",
      " |  is_commutative\n",
      " |  \n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |      \n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |  \n",
      " |  is_complex\n",
      " |  \n",
      " |  is_composite\n",
      " |  \n",
      " |  is_even\n",
      " |  \n",
      " |  is_extended_negative\n",
      " |  \n",
      " |  is_extended_nonnegative\n",
      " |  \n",
      " |  is_extended_nonpositive\n",
      " |  \n",
      " |  is_extended_nonzero\n",
      " |  \n",
      " |  is_extended_positive\n",
      " |  \n",
      " |  is_extended_real\n",
      " |  \n",
      " |  is_finite\n",
      " |  \n",
      " |  is_hermitian\n",
      " |  \n",
      " |  is_imaginary\n",
      " |  \n",
      " |  is_infinite\n",
      " |  \n",
      " |  is_integer\n",
      " |  \n",
      " |  is_irrational\n",
      " |  \n",
      " |  is_negative\n",
      " |  \n",
      " |  is_noninteger\n",
      " |  \n",
      " |  is_nonnegative\n",
      " |  \n",
      " |  is_nonpositive\n",
      " |  \n",
      " |  is_nonzero\n",
      " |  \n",
      " |  is_odd\n",
      " |  \n",
      " |  is_polar\n",
      " |  \n",
      " |  is_positive\n",
      " |  \n",
      " |  is_prime\n",
      " |  \n",
      " |  is_rational\n",
      " |  \n",
      " |  is_real\n",
      " |  \n",
      " |  is_transcendental\n",
      " |  \n",
      " |  is_zero\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  is_Add = False\n",
      " |  \n",
      " |  is_AlgebraicNumber = False\n",
      " |  \n",
      " |  is_Atom = False\n",
      " |  \n",
      " |  is_Boolean = False\n",
      " |  \n",
      " |  is_Derivative = False\n",
      " |  \n",
      " |  is_Dummy = False\n",
      " |  \n",
      " |  is_Equality = False\n",
      " |  \n",
      " |  is_Float = False\n",
      " |  \n",
      " |  is_Indexed = False\n",
      " |  \n",
      " |  is_Integer = False\n",
      " |  \n",
      " |  is_MatAdd = False\n",
      " |  \n",
      " |  is_MatMul = False\n",
      " |  \n",
      " |  is_Matrix = False\n",
      " |  \n",
      " |  is_Mul = False\n",
      " |  \n",
      " |  is_Not = False\n",
      " |  \n",
      " |  is_Number = False\n",
      " |  \n",
      " |  is_NumberSymbol = False\n",
      " |  \n",
      " |  is_Order = False\n",
      " |  \n",
      " |  is_Piecewise = False\n",
      " |  \n",
      " |  is_Point = False\n",
      " |  \n",
      " |  is_Poly = False\n",
      " |  \n",
      " |  is_Pow = False\n",
      " |  \n",
      " |  is_Rational = False\n",
      " |  \n",
      " |  is_Relational = False\n",
      " |  \n",
      " |  is_Symbol = False\n",
      " |  \n",
      " |  is_Vector = False\n",
      " |  \n",
      " |  is_Wild = False\n",
      " |  \n",
      " |  is_symbol = False\n",
      " |  \n",
      " |  kind = UndefinedKind\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.printing.defaults.Printable:\n",
      " |  \n",
      " |  __repr__ = __str__(self)\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |  \n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |      \n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |      \n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |      \n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |      \n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |      \n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |      \n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |      \n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |      \n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |      \n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |      \n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |  \n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(gamma)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 365,
   "id": "4a6edf3b",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=ChiSquared(\"X\",k)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 374,
   "id": "f78c002a",
   "metadata": {},
   "outputs": [],
   "source": [
    "func=density(X)(x).subs(k,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 375,
   "id": "d2e83dc8",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAnIAAAHTCAYAAACjhvVDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAp9UlEQVR4nO3de3RU5b3/8c+eSTK5GALhHuTaQwsEFCTAEVCwrSiCl+WvtXihrrKOP12igKx6gFprqwfi5RxKTxEUeo7aZVHq+uHldNVLjgdBitRwEwUFqQgcJEUUc4NMMjP798dMBgIBkjBhZz/P+7XWrJl59iXf7OUyH55nP892XNd1BQAAAN8JeF0AAAAAWoYgBwAA4FMEOQAAAJ8iyAEAAPgUQQ4AAMCnCHIAAAA+RZADAADwKWuCnOu6qqioEMvmAQAAU1gT5CorK5WXl6fKykqvSwEAAEgJa4IcAACAaQhyAAAAPkWQAwAA8CmCHAAAgE8R5AAAAHyKIAcAAOBTBDkAAACfIsgBAAD4FEEOAADApwhyAAAAPkWQAwAA8CmCHAAAgE8R5AAAAHyKIAcAAOBTBDkAAACfIsgBAAD4FEEOAADAp6wJcm9tL5MkVYcjHlcCAACQGtYEuQde+VCS9HV1rceVAAAApIY1QQ4AAMA0BDkAAACfIsgBAAD4FEEOAADApwhyAAAAPkWQAwAA8ClrgpyTeHfleloHAABAqlgT5AAAAExDkAMAAPApghwAAIBPEeQAAAB8iiAHAADgUwQ5AAAAnyLIAQAA+JQ1Qc5x4ivJuSwjBwAADGFNkAM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+XojwMAAKZpdo9cVVWVnn76aY0fP155eXnq06ePBg0apM6dO6t379664447VFpa2hq1AgAA4ATNCnK//vWv1adPHy1fvlzf/e53tWrVKm3dulU7d+7Ue++9p4ceekiRSERXXnmlrr76an366aetVXeLMbIKAABM0ayh1fXr12v16tUaMmRIo9tHjhypadOm6amnntJ//Md/aM2aNerfv39KCj1XzHUAAACmaVaQe+mll5KfKysrlZub2+h+oVBId99997lVBgAAgDNq8azVyy67TGVlZams5bxwmbYKAAAM0eIgV1RUpFGjRumTTz5p0L5lyxZdc80151xYqjGyCgAATNPiIPe73/1O06ZN09ixY7Vu3Trt2rVLN910k4qKihQKhVJZY0rRHwcAAExxTuvIPfTQQ8rIyNCVV16paDSqq666SqWlpbrkkktSVV/KOInZDoysAgAAU7S4R+7gwYOaMWOGHnnkEQ0aNEjp6emaMmVKmwxx0olDqyQ5AABghhYHuX79+undd9/VSy+9pE2bNmnVqlW6++679dhjj6WyvpRJLj9CjgMAAIZo8dDqM888oylTpiS/X3XVVVq9erUmT56svXv3asmSJSkpMFWcRJ8cOQ4AAJiixT1yJ4a4epdcconWr1+vd95551xqahX1PXLcIwcAAEzR4iB3On369NFf/vKXVJ/2nNUHuRhJDgAAGKJZQW7fvn1N2q9Dhw6SpAMHDjS/olbC0CoAADBNs4LciBEjdMcdd+j9998/7T7l5eVavny5Bg8erFWrVp1zgalyfGiVKAcAAMzQrMkO119/vXJzc3X11VcrPT1dRUVFKigoUGZmpo4cOaIdO3Zo+/btKioq0hNPPKGJEye2Vt3N5vBoBwAAYJhmBblnn31W+/fv17/8y7+oa9eu6t69uw4fPqxjx46pU6dOuvXWW3XVVVdp8ODBrVVviyWHVumQAwAAhmhWkOvRo4e2bNmiq6++WlVVVVqwYIG6dOnSWrWlVv3QKnfJAQAAQzTrHrmf/vSnuu666zR69Gg5jqM//OEPKi0t1bFjx1qrvpRJzlqNeVsHAABAqjQryE2fPl1btmzR5MmT5bqunnzySV166aVq166dBg4cqClTpujRRx/V66+/3l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f385z9X3759lZWVpX79+unhhx9WLMbTfFtq7dq1uvbaa1VQUCDHcfTKK6802O66rn75y1+qoKBAWVlZGj9+vLZv3+5NsT50putbV1enOXPmaMiQIcrJyVFBQYF+/OMf64svvvCsXuOD3MqVKzVr1iz99Kc/lSRdeumlmjhxovbt2+dxZWZYs2aNpk+frg0bNqikpESRSEQTJkxQdXW116UZp7S0VMuWLdNFF13kdSlGOXLkiMaMGaP09HS9/vrr2rFjh/7t3/5N7du397o0Izz22GN66qmntHjxYn388cd6/PHH9cQTT+i3v/2t16X5VnV1tS6++GItXry40e2PP/64Fi5cqMWLF6u0tFTdunXTlVdeedbHYSLuTNf36NGj2rx5sx588EFt3rxZq1at0q5du3Tdddd5UGmCa7iRI0e6d911l1teXu5KcsvLy90BAwa4c+fO9bo0Ix06dMiV5K5Zs8brUoxSWVnp9u/f3y0pKXHHjRvnzpw50+uSjDFnzhx37NixXpdhrEmTJrnTpk1r0HbjjTe6t912m0cVmUWS+/LLLye/x2Ixt1u3bu6jjz6abKupqXHz8vLcp556yoMK/e3k69uY999/35Xk7t279/wUdRKje+Rqa2u1adMmTZgwoUH7hAkTtH79eo+qMlt5ebkkKT8/3+NKzDJ9+nRNmjRJ3//+970uxTivvfaaioqK9MMf/lBdunTRsGHDtHz5cq/LMsbYsWP19ttva9euXZKkDz74QOvWrdM111zjcWVm2rNnj8rKyhr83QuFQho3bhx/91pJeXm5HMfxrBffN092aInDhw8rGo2qa9euDdq7du2qsrIyj6oyl+u6mj17tsaOHavBgwd7XY4xXnzxRW3evFmlpaVel2Kkzz77TEuXLtXs2bP1s5/9TO+//75mzJihUCikH//4x16X53tz5sxReXm5BgwYoGAwqGg0qvnz5+vmm2/2ujQj1f9ta+zv3t69e70oyWg1NTWaO3eubrnlFs8eNmB0kKvnOE6D767rntKGc3fPPfdo27ZtWrdundelGGP//v2aOXOm3nrrLWVmZnpdjpFisZiKioq0YMECSdKwYcO0fft2LV26lCCXAitXrtTzzz+vFStWqLCwUFu3btW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AF5xXVdDhw7VZZddpsWLF+tXv/qVfve732nDhg3q0aOH1+UBwBmleV0AAHjJcRzNnz9fP/jBD1RQUKDf/OY3evfddwlxAHyBHjkAkHTJJZdo+/bteuuttzRu3DivywGAJuEeOQDWe/PNN/XJJ58oGo2qa9euXpcDAE1GjxwAq23evFnjx4/Xk08+qRdffFHZ2dl66aWXvC4LAJqEe+QAWOvzzz/XpEmTNHfuXE2dOlWDBg3SiBEjtGnTJg0fPtzr8gDgrOiRA2Clr7/+WmPGjNHll1+up59+Otl+/fXXKxwO64033vCwOgBoGoIcAACATzHZAQAAwKcIcgAAAD5FkAMAAPApghwAAIBPEeQAAAB8iiAHAADgUwQ5AAAAnyLIAQAA+BRBDgAAwKcIcgAAAD5FkAMAAPCp/w9NdaKnowrI0QAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<sympy.plotting.plot.Plot at 0x7f8f792685b0>"
      ]
     },
     "execution_count": 375,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(func,(x,0,12))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 376,
   "id": "31b7e5d8",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAnIAAAHTCAYAAACjhvVDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9WElEQVR4nO3deXxU9b3/8fcsyWQhC0kgISFAUFQgiJIAgsa1gkCtVlugVtEi3sst1iLVn1DbWr1WWm3tIgLuXlsXrhVb24tLrMqqBUNwARQQJCwJIUBmsiczc35/TGZIJCAJSc6czOv5cB4z851z5nxyUPL2+z3f77EZhmEIAAAAlmM3uwAAAAB0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tISHhmGsN4+PjlZqayjWIneD222/X+PHj9cADD2jq1Klav369Hn/8cT3++ONml9YjXHnllfrVr36lAQMGaPjw4SouLtbDDz+smTNnml2aJVVXV2vHjh2h97t27dKmTZuUkpKiAQMGaO7cuXrggQc0ZMgQDRkyRA888IDi4uJ03XXXmVi1dZzo/GZmZuo73/mONm7cqH/+85/y+Xyh33UpKSmKjo7u3mK7fZ5smFi0aJGRnZ1tREVFGaNGjWJ5jE4iqc3HM888Y3ZpPRLLj3Suf/zjH0Zubq7hcrmMs846y3j88cfNLqnH8Hg8xo9//GNjwIABRkxMjDF48GDj7rvvNhoaGswuzZLefffdNv+uvfHGGw3DCCxBcs899xgZGRmGy+UyLrzwQuOTTz4xt2gLOdH53bVr13F/17377rvdXqvNMAyjO4MjAAAAOkfEXSMHAADQUxDkAAAALIogBwAAYFEEOQAAAIsiyAEAAFgUQQ4AAMCiCHIAAAAWRZADAACwKIIcAACARRHkAAAALIogBwAAYFEEOQCQ9OKLLyomJkb79u0Ltc2aNUtnn3223G63iZUBwPHZDMMwzC4CAMxmGIbOOeccFRQUaNGiRbr33nv15JNP6oMPPlBWVpbZ5QFAm5xmFwAA4cBms+lXv/qVvvOd7ygzM1N//OMftXr1akIcgLBGjxwAtDBq1Cht3rxZb731li666CKzywGAE+IaOQBo9uabb+qzzz6Tz+dTenq62eUAwNeiRw4AJG3cuFEXX3yxHn30Ub300kuKi4vTyy+/bHZZAHBCXCMHIOJ9+eWXmjJliubPn68bbrhBw4YN0+jRo1VUVKS8vDyzywOA46JHDkBEO3z4sM4//3xdeOGFeuyxx0LtV111lRoaGvTGG2+YWB0AnBhBDgAAwKKY7AAAAGBRBDkAAACLIsgBAABYFEEOAADAoghyAAAAFkWQAwAAsCiCHAAAgEUR5AAAACyKIAcAAGBRBDkAAACLIsgBAABY1P8HwUKKwc4XFRwAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<sympy.plotting.plot.Plot at 0x7f8f485b2c70>"
      ]
     },
     "execution_count": 376,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(integrate(func,x),(x,0,12))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7c8a8919",
   "metadata": {},
   "source": [
    "### 核红"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 428,
   "id": "9c3e0bc8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0.81$"
      ],
      "text/plain": [
       "0.810000000000000"
      ]
     },
     "execution_count": 428,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S(64.8)/80"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "459a53a8",
   "metadata": {},
   "source": [
    "## 一轮复习"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7ed87cfa",
   "metadata": {},
   "source": [
    "### 集合与常用逻辑用语"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 432,
   "id": "e2ead455",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=FiniteSet(-2,-1,0,1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 433,
   "id": "92209f42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2, -1, 0, 1, 2\\right\\}$"
      ],
      "text/plain": [
       "{-2, -1, 0, 1, 2}"
      ]
     },
     "execution_count": 433,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 434,
   "id": "4790cdfe",
   "metadata": {},
   "outputs": [],
   "source": [
    "N=solveset(x**2-x-6>=0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 435,
   "id": "1f582a3e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty, -2\\right] \\cup \\left[3, \\infty\\right)$"
      ],
      "text/plain": [
       "Union(Interval(-oo, -2), Interval(3, oo))"
      ]
     },
     "execution_count": 435,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 436,
   "id": "6819c5e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2\\right\\}$"
      ],
      "text/plain": [
       "{-2}"
      ]
     },
     "execution_count": 436,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Intersection(M,N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 442,
   "id": "0c9c2e46",
   "metadata": {},
   "outputs": [],
   "source": [
    "U=FiniteSet(1,2,3,4,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 443,
   "id": "76a50952",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1, 2, 3, 4, 5\\right\\}$"
      ],
      "text/plain": [
       "{1, 2, 3, 4, 5}"
      ]
     },
     "execution_count": 443,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "U"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 448,
   "id": "aa497562",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=FiniteSet(1,4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 450,
   "id": "0fe340f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "N=FiniteSet(2,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 452,
   "id": "e76e481d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{2, 3, 5\\right\\}$"
      ],
      "text/plain": [
       "{2, 3, 5}"
      ]
     },
     "execution_count": 452,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "U-M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 451,
   "id": "46ebc166",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{2, 3, 5\\right\\}$"
      ],
      "text/plain": [
       "{2, 3, 5}"
      ]
     },
     "execution_count": 451,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N+(U-M)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 453,
   "id": "9ce5b3cf",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=solveset(x<1,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 454,
   "id": "53911ec2",
   "metadata": {},
   "outputs": [],
   "source": [
    "N=Interval.open(-1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 456,
   "id": "eeae615c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[2, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval(2, oo)"
      ]
     },
     "execution_count": 456,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Reals-(M+N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 458,
   "id": "d35cb59c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty, -1\\right] \\cup \\left[1, \\infty\\right)$"
      ],
      "text/plain": [
       "Union(Interval(-oo, -1), Interval(1, oo))"
      ]
     },
     "execution_count": 458,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Reals- Intersection(M,N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 460,
   "id": "70f60291",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-1, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval.open(-1, oo)"
      ]
     },
     "execution_count": 460,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N+(Reals-M)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 461,
   "id": "ffb421d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty, 1\\right) \\cup \\left[2, \\infty\\right)$"
      ],
      "text/plain": [
       "Union(Interval.open(-oo, 1), Interval(2, oo))"
      ]
     },
     "execution_count": 461,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M+(Reals-N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 465,
   "id": "ca8536ea",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=solveset(sqrt(x)<4,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 466,
   "id": "417dd00b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[0, 16\\right)$"
      ],
      "text/plain": [
       "Interval.Ropen(0, 16)"
      ]
     },
     "execution_count": 466,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 467,
   "id": "4e0ec9b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "N=solveset(3*x>=1,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 468,
   "id": "57c9dfa8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\frac{1}{3}, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval(1/3, oo)"
      ]
     },
     "execution_count": 468,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 469,
   "id": "ddfee86c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\frac{1}{3}, 16\\right)$"
      ],
      "text/plain": [
       "Interval.Ropen(1/3, 16)"
      ]
     },
     "execution_count": 469,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Intersection(N,M)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 470,
   "id": "dcf5b8c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=function_range(cos(x),x,Interval(0,pi))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 471,
   "id": "eb99e46f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[-1, 1\\right]$"
      ],
      "text/plain": [
       "Interval(-1, 1)"
      ]
     },
     "execution_count": 471,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 472,
   "id": "9709e055",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=solveset(x**2<x,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 473,
   "id": "7b50a18d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(0, 1\\right)$"
      ],
      "text/plain": [
       "Interval.open(0, 1)"
      ]
     },
     "execution_count": 473,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 474,
   "id": "cef861ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(0, 1\\right)$"
      ],
      "text/plain": [
       "Interval.open(0, 1)"
      ]
     },
     "execution_count": 474,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Intersection(A,B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 572,
   "id": "a155c0dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=solveset(ln(x-1)<0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 573,
   "id": "9f10b4ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(1, 2\\right)$"
      ],
      "text/plain": [
       "Interval.open(1, 2)"
      ]
     },
     "execution_count": 573,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 574,
   "id": "3d875e22",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=function_range(2**x-1,x,A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 575,
   "id": "c75bdd2c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(1, 3\\right)$"
      ],
      "text/plain": [
       "Interval.open(1, 3)"
      ]
     },
     "execution_count": 575,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 480,
   "id": "8272ad21",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(1, 3\\right)$"
      ],
      "text/plain": [
       "Interval.open(1, 3)"
      ]
     },
     "execution_count": 480,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A+B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 482,
   "id": "f2d212d4",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=symbols(\"a\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 483,
   "id": "37e5eef4",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=solveset(a*x-1,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 484,
   "id": "e98c431c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\mathbb{R} \\cap \\left\\{\\frac{1}{a}\\right\\}$"
      ],
      "text/plain": [
       "Intersection({1/a}, Reals)"
      ]
     },
     "execution_count": 484,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 485,
   "id": "1e3dfb9e",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=solve_univariate_inequalities([2<=x,x<5],x,Naturals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 486,
   "id": "6c41a61e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{2, 3, 4\\right\\}$"
      ],
      "text/plain": [
       "Range(2, 5, 1)"
      ]
     },
     "execution_count": 486,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 487,
   "id": "10a46820",
   "metadata": {},
   "outputs": [],
   "source": [
    "M=solveset(x**2-x-2<0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 488,
   "id": "d50f45e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-1, 2\\right)$"
      ],
      "text/plain": [
       "Interval.open(-1, 2)"
      ]
     },
     "execution_count": 488,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 491,
   "id": "3475a542",
   "metadata": {},
   "outputs": [],
   "source": [
    "N=continuous_domain(sqrt(1-ln(x)),x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 492,
   "id": "7a966583",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(0, e\\right]$"
      ],
      "text/plain": [
       "Interval.Lopen(0, E)"
      ]
     },
     "execution_count": 492,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 515,
   "id": "28c2373c",
   "metadata": {},
   "outputs": [],
   "source": [
    "U=FiniteSet(1,2,3,4,5,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 516,
   "id": "a10a7636",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=FiniteSet(1,2,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 517,
   "id": "9f5f953c",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=FiniteSet(3,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 518,
   "id": "3bf77da4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{4, 5\\right\\}$"
      ],
      "text/plain": [
       "{4, 5}"
      ]
     },
     "execution_count": 518,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "U-(A+B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 520,
   "id": "c8a343e0",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class ImageSet in module sympy.sets.fancysets:\n",
      "\n",
      "class ImageSet(sympy.sets.sets.Set)\n",
      " |  ImageSet(flambda, *sets)\n",
      " |  \n",
      " |  Image of a set under a mathematical function. The transformation\n",
      " |  must be given as a Lambda function which has as many arguments\n",
      " |  as the elements of the set upon which it operates, e.g. 1 argument\n",
      " |  when acting on the set of integers or 2 arguments when acting on\n",
      " |  a complex region.\n",
      " |  \n",
      " |  This function is not normally called directly, but is called\n",
      " |  from ``imageset``.\n",
      " |  \n",
      " |  \n",
      " |  Examples\n",
      " |  ========\n",
      " |  \n",
      " |  >>> from sympy import Symbol, S, pi, Dummy, Lambda\n",
      " |  >>> from sympy import FiniteSet, ImageSet, Interval\n",
      " |  \n",
      " |  >>> x = Symbol('x')\n",
      " |  >>> N = S.Naturals\n",
      " |  >>> squares = ImageSet(Lambda(x, x**2), N) # {x**2 for x in N}\n",
      " |  >>> 4 in squares\n",
      " |  True\n",
      " |  >>> 5 in squares\n",
      " |  False\n",
      " |  \n",
      " |  >>> FiniteSet(0, 1, 2, 3, 4, 5, 6, 7, 9, 10).intersect(squares)\n",
      " |  {1, 4, 9}\n",
      " |  \n",
      " |  >>> square_iterable = iter(squares)\n",
      " |  >>> for i in range(4):\n",
      " |  ...     next(square_iterable)\n",
      " |  1\n",
      " |  4\n",
      " |  9\n",
      " |  16\n",
      " |  \n",
      " |  If you want to get value for `x` = 2, 1/2 etc. (Please check whether the\n",
      " |  `x` value is in ``base_set`` or not before passing it as args)\n",
      " |  \n",
      " |  >>> squares.lamda(2)\n",
      " |  4\n",
      " |  >>> squares.lamda(S(1)/2)\n",
      " |  1/4\n",
      " |  \n",
      " |  >>> n = Dummy('n')\n",
      " |  >>> solutions = ImageSet(Lambda(n, n*pi), S.Integers) # solutions of sin(x) = 0\n",
      " |  >>> dom = Interval(-1, 1)\n",
      " |  >>> dom.intersect(solutions)\n",
      " |  {0}\n",
      " |  \n",
      " |  See Also\n",
      " |  ========\n",
      " |  \n",
      " |  sympy.sets.sets.imageset\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      ImageSet\n",
      " |      sympy.sets.sets.Set\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __iter__(self)\n",
      " |  \n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(cls, flambda, *sets)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties defined here:\n",
      " |  \n",
      " |  base_pset\n",
      " |  \n",
      " |  base_set\n",
      " |  \n",
      " |  base_sets\n",
      " |  \n",
      " |  is_iterable\n",
      " |  \n",
      " |  lamda\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  default_assumptions = {}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  __add__(self, other)\n",
      " |  \n",
      " |  __and__(self, other)\n",
      " |  \n",
      " |  __contains__(self, other)\n",
      " |  \n",
      " |  __mul__(self, other)\n",
      " |  \n",
      " |  __or__(self, other)\n",
      " |  \n",
      " |  __pow__(self, exp)\n",
      " |  \n",
      " |  __sub__(self, other)\n",
      " |  \n",
      " |  __xor__(self, other)\n",
      " |  \n",
      " |  complement(self, universe)\n",
      " |      The complement of 'self' w.r.t the given universe.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(0, 1).complement(S.Reals)\n",
      " |      Union(Interval.open(-oo, 0), Interval.open(1, oo))\n",
      " |      \n",
      " |      >>> Interval(0, 1).complement(S.UniversalSet)\n",
      " |      Complement(UniversalSet, Interval(0, 1))\n",
      " |  \n",
      " |  contains(self, other)\n",
      " |      Returns a SymPy value indicating whether ``other`` is contained\n",
      " |      in ``self``: ``true`` if it is, ``false`` if it is not, else\n",
      " |      an unevaluated ``Contains`` expression (or, as in the case of\n",
      " |      ConditionSet and a union of FiniteSet/Intervals, an expression\n",
      " |      indicating the conditions for containment).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(0.5)\n",
      " |      True\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``in`` operator, but that\n",
      " |      will raise an error unless an affirmative true or false is not\n",
      " |      obtained.\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(x)\n",
      " |      (0 <= x) & (x <= 1)\n",
      " |      >>> x in Interval(0, 1)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      TypeError: did not evaluate to a bool: None\n",
      " |      \n",
      " |      The result of 'in' is a bool, not a SymPy value\n",
      " |      \n",
      " |      >>> 1 in Interval(0, 2)\n",
      " |      True\n",
      " |      >>> _ is S.true\n",
      " |      False\n",
      " |  \n",
      " |  intersect(self, other)\n",
      " |      Returns the intersection of 'self' and 'other'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      \n",
      " |      >>> Interval(1, 3).intersect(Interval(1, 2))\n",
      " |      Interval(1, 2)\n",
      " |      \n",
      " |      >>> from sympy import imageset, Lambda, symbols, S\n",
      " |      >>> n, m = symbols('n m')\n",
      " |      >>> a = imageset(Lambda(n, 2*n), S.Integers)\n",
      " |      >>> a.intersect(imageset(Lambda(m, 2*m + 1), S.Integers))\n",
      " |      EmptySet\n",
      " |  \n",
      " |  intersection(self, other)\n",
      " |      Alias for :meth:`intersect()`\n",
      " |  \n",
      " |  is_disjoint(self, other)\n",
      " |      Returns True if ``self`` and ``other`` are disjoint.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(1, 2))\n",
      " |      False\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(3, 4))\n",
      " |      True\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Disjoint_sets\n",
      " |  \n",
      " |  is_proper_subset(self, other)\n",
      " |      Returns True if ``self`` is a proper subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_proper_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_subset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_proper_superset(self, other)\n",
      " |      Returns True if ``self`` is a proper superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 0.5))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_subset(self, other)\n",
      " |      Returns True if ``self`` is a subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_subset(Interval(0, 1, left_open=True))\n",
      " |      False\n",
      " |  \n",
      " |  is_superset(self, other)\n",
      " |      Returns True if ``self`` is a superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_superset(Interval(0, 1))\n",
      " |      False\n",
      " |      >>> Interval(0, 1).is_superset(Interval(0, 1, left_open=True))\n",
      " |      True\n",
      " |  \n",
      " |  isdisjoint(self, other)\n",
      " |      Alias for :meth:`is_disjoint()`\n",
      " |  \n",
      " |  issubset(self, other)\n",
      " |      Alias for :meth:`is_subset()`\n",
      " |  \n",
      " |  issuperset(self, other)\n",
      " |      Alias for :meth:`is_superset()`\n",
      " |  \n",
      " |  powerset(self)\n",
      " |      Find the Power set of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import EmptySet, FiniteSet, Interval\n",
      " |      \n",
      " |      A power set of an empty set:\n",
      " |      \n",
      " |      >>> A = EmptySet\n",
      " |      >>> A.powerset()\n",
      " |      {EmptySet}\n",
      " |      \n",
      " |      A power set of a finite set:\n",
      " |      \n",
      " |      >>> A = FiniteSet(1, 2)\n",
      " |      >>> a, b, c = FiniteSet(1), FiniteSet(2), FiniteSet(1, 2)\n",
      " |      >>> A.powerset() == FiniteSet(a, b, c, EmptySet)\n",
      " |      True\n",
      " |      \n",
      " |      A power set of an interval:\n",
      " |      \n",
      " |      >>> Interval(1, 2).powerset()\n",
      " |      PowerSet(Interval(1, 2))\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Power_set\n",
      " |  \n",
      " |  symmetric_difference(self, other)\n",
      " |      Returns symmetric difference of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(1, 3).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(3, oo))\n",
      " |      >>> Interval(1, 10).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(10, oo))\n",
      " |      \n",
      " |      >>> from sympy import S, EmptySet\n",
      " |      >>> S.Reals.symmetric_difference(EmptySet)\n",
      " |      Reals\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      .. [1] https://en.wikipedia.org/wiki/Symmetric_difference\n",
      " |  \n",
      " |  union(self, other)\n",
      " |      Returns the union of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``+`` operator:\n",
      " |      \n",
      " |      >>> from sympy import Interval, FiniteSet\n",
      " |      >>> Interval(0, 1).union(Interval(2, 3))\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(0, 1) + Interval(2, 3)\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(1, 2, True, True) + FiniteSet(2, 3)\n",
      " |      Union({3}, Interval.Lopen(1, 2))\n",
      " |      \n",
      " |      Similarly it is possible to use the ``-`` operator for set differences:\n",
      " |      \n",
      " |      >>> Interval(0, 2) - Interval(0, 1)\n",
      " |      Interval.Lopen(1, 2)\n",
      " |      >>> Interval(1, 3) - FiniteSet(2)\n",
      " |      Union(Interval.Ropen(1, 2), Interval.Lopen(2, 3))\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  boundary\n",
      " |      The boundary or frontier of a set.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A point x is on the boundary of a set S if\n",
      " |      \n",
      " |      1.  x is in the closure of S.\n",
      " |          I.e. Every neighborhood of x contains a point in S.\n",
      " |      2.  x is not in the interior of S.\n",
      " |          I.e. There does not exist an open set centered on x contained\n",
      " |          entirely within S.\n",
      " |      \n",
      " |      There are the points on the outer rim of S.  If S is open then these\n",
      " |      points need not actually be contained within S.\n",
      " |      \n",
      " |      For example, the boundary of an interval is its start and end points.\n",
      " |      This is true regardless of whether or not the interval is open.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).boundary\n",
      " |      {0, 1}\n",
      " |      >>> Interval(0, 1, True, False).boundary\n",
      " |      {0, 1}\n",
      " |  \n",
      " |  closure\n",
      " |      Property method which returns the closure of a set.\n",
      " |      The closure is defined as the union of the set itself and its\n",
      " |      boundary.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S, Interval\n",
      " |      >>> S.Reals.closure\n",
      " |      Reals\n",
      " |      >>> Interval(0, 1).closure\n",
      " |      Interval(0, 1)\n",
      " |  \n",
      " |  inf\n",
      " |      The infimum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).inf\n",
      " |      0\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).inf\n",
      " |      0\n",
      " |  \n",
      " |  interior\n",
      " |      Property method which returns the interior of a set.\n",
      " |      The interior of a set S consists all points of S that do not\n",
      " |      belong to the boundary of S.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).interior\n",
      " |      Interval.open(0, 1)\n",
      " |      >>> Interval(0, 1).boundary.interior\n",
      " |      EmptySet\n",
      " |  \n",
      " |  is_EmptySet\n",
      " |  \n",
      " |  is_closed\n",
      " |      A property method to check whether a set is closed.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is closed if its complement is an open set. The closedness of a\n",
      " |      subset of the reals is determined with respect to R and its standard\n",
      " |      topology.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_closed\n",
      " |      True\n",
      " |  \n",
      " |  is_open\n",
      " |      Property method to check whether a set is open.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is open if and only if it has an empty intersection with its\n",
      " |      boundary. In particular, a subset A of the reals is open if and only\n",
      " |      if each one of its points is contained in an open interval that is a\n",
      " |      subset of A.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S\n",
      " |      >>> S.Reals.is_open\n",
      " |      True\n",
      " |      >>> S.Rationals.is_open\n",
      " |      False\n",
      " |  \n",
      " |  kind\n",
      " |      The kind of a Set\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      Any :class:`Set` will have kind :class:`SetKind` which is\n",
      " |      parametrised by the kind of the elements of the set. For example\n",
      " |      most sets are sets of numbers and will have kind\n",
      " |      ``SetKind(NumberKind)``. If elements of sets are different in kind than\n",
      " |      their kind will ``SetKind(UndefinedKind)``. See\n",
      " |      :class:`sympy.core.kind.Kind` for an explanation of the kind system.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Matrix, FiniteSet, EmptySet, ProductSet, PowerSet\n",
      " |      \n",
      " |      >>> FiniteSet(Matrix([1, 2])).kind\n",
      " |      SetKind(MatrixKind(NumberKind))\n",
      " |      \n",
      " |      >>> Interval(1, 2).kind\n",
      " |      SetKind(NumberKind)\n",
      " |      \n",
      " |      >>> EmptySet.kind\n",
      " |      SetKind()\n",
      " |      \n",
      " |      A :class:`sympy.sets.powerset.PowerSet` is a set of sets:\n",
      " |      \n",
      " |      >>> PowerSet({1, 2, 3}).kind\n",
      " |      SetKind(SetKind(NumberKind))\n",
      " |      \n",
      " |      A :class:`ProductSet` represents the set of tuples of elements of\n",
      " |      other sets. Its kind is :class:`sympy.core.containers.TupleKind`\n",
      " |      parametrised by the kinds of the elements of those sets:\n",
      " |      \n",
      " |      >>> p = ProductSet(FiniteSet(1, 2), FiniteSet(3, 4))\n",
      " |      >>> list(p)\n",
      " |      [(1, 3), (2, 3), (1, 4), (2, 4)]\n",
      " |      >>> p.kind\n",
      " |      SetKind(TupleKind(NumberKind, NumberKind))\n",
      " |      \n",
      " |      When all elements of the set do not have same kind, the kind\n",
      " |      will be returned as ``SetKind(UndefinedKind)``:\n",
      " |      \n",
      " |      >>> FiniteSet(0, Matrix([1, 2])).kind\n",
      " |      SetKind(UndefinedKind)\n",
      " |      \n",
      " |      The kind of the elements of a set are given by the ``element_kind``\n",
      " |      attribute of ``SetKind``:\n",
      " |      \n",
      " |      >>> Interval(1, 2).kind.element_kind\n",
      " |      NumberKind\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      NumberKind\n",
      " |      sympy.core.kind.UndefinedKind\n",
      " |      sympy.core.containers.TupleKind\n",
      " |      MatrixKind\n",
      " |      sympy.matrices.expressions.sets.MatrixSet\n",
      " |      sympy.sets.conditionset.ConditionSet\n",
      " |      Rationals\n",
      " |      Naturals\n",
      " |      Integers\n",
      " |      sympy.sets.fancysets.ImageSet\n",
      " |      sympy.sets.fancysets.Range\n",
      " |      sympy.sets.fancysets.ComplexRegion\n",
      " |      sympy.sets.powerset.PowerSet\n",
      " |      sympy.sets.sets.ProductSet\n",
      " |      sympy.sets.sets.Interval\n",
      " |      sympy.sets.sets.Union\n",
      " |      sympy.sets.sets.Intersection\n",
      " |      sympy.sets.sets.Complement\n",
      " |      sympy.sets.sets.EmptySet\n",
      " |      sympy.sets.sets.UniversalSet\n",
      " |      sympy.sets.sets.FiniteSet\n",
      " |      sympy.sets.sets.SymmetricDifference\n",
      " |      sympy.sets.sets.DisjointUnion\n",
      " |  \n",
      " |  measure\n",
      " |      The (Lebesgue) measure of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).measure\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).measure\n",
      " |      2\n",
      " |  \n",
      " |  sup\n",
      " |      The supremum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).sup\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).sup\n",
      " |      3\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.sets.sets.Set:\n",
      " |  \n",
      " |  __annotations__ = {'is_Complement': typing.Optional[bool], 'is_Interse...\n",
      " |  \n",
      " |  is_Complement = None\n",
      " |  \n",
      " |  is_ComplexRegion = False\n",
      " |  \n",
      " |  is_FiniteSet = False\n",
      " |  \n",
      " |  is_Intersection = None\n",
      " |  \n",
      " |  is_Interval = False\n",
      " |  \n",
      " |  is_ProductSet = False\n",
      " |  \n",
      " |  is_Union = False\n",
      " |  \n",
      " |  is_UniversalSet = None\n",
      " |  \n",
      " |  is_empty = None\n",
      " |  \n",
      " |  is_finite_set = None\n",
      " |  \n",
      " |  is_interval = False\n",
      " |  \n",
      " |  is_number = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |      \n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      from https://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |  \n",
      " |  __getnewargs__(self)\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __hash__(self) -> 'int'\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __ne__(self, other)\n",
      " |      ``a != b``  -> Compare two symbolic trees and see whether they are different\n",
      " |      \n",
      " |      this is the same as:\n",
      " |      \n",
      " |      ``a.compare(b) != 0``\n",
      " |      \n",
      " |      but faster\n",
      " |  \n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      A stub to allow Basic args (like Tuple) to be skipped when computing\n",
      " |      the content and primitive components of an expression.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.core.expr.Expr.as_content_primitive\n",
      " |  \n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |  \n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |      \n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |      \n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |      \n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |      \n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |      \n",
      " |      The type can be given implicitly, too:\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |      \n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |      \n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |  \n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |      \n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |  \n",
      " |  copy(self)\n",
      " |  \n",
      " |  could_extract_minus_sign(self)\n",
      " |  \n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |  \n",
      " |  count_ops(self, visual=None)\n",
      " |      Wrapper for count_ops that returns the operation count.\n",
      " |  \n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> u = Dummy('u')\n",
      " |      \n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |      \n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |  \n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |  \n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |      \n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |      \n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |      \n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |      \n",
      " |      \n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |      \n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |  \n",
      " |  has_free(self, *patterns)\n",
      " |      Return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |      \n",
      " |      This works for subexpressions and types, too:\n",
      " |      \n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |  \n",
      " |  has_xfree(self, s: 'set[Basic]')\n",
      " |      Return True if self has any of the patterns in s as a\n",
      " |      free argument, else False. This is like `Basic.has_free`\n",
      " |      but this will only report exact argument matches.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> f(x).has_xfree({f})\n",
      " |      False\n",
      " |      >>> f(x).has_xfree({f(x)})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x + 1})\n",
      " |      True\n",
      " |      >>> f(x + y + 1).has_xfree({x + 1})\n",
      " |      False\n",
      " |  \n",
      " |  is_hypergeometric(self, k)\n",
      " |  \n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |      \n",
      " |      Wild symbols match all.\n",
      " |      \n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |      \n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |      \n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |      \n",
      " |      But they can be identified if desired:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |      \n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |      \n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |  \n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |  \n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |      \n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |      \n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |      \n",
      " |      however, you can use:\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |  \n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |  \n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |      \n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself does not match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |      \n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |      \n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |      \n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      Initial setup\n",
      " |      \n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |      \n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |      \n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |      \n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |      \n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |      \n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |      \n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |      \n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |      \n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |      \n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |      \n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |      \n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |      \n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |      \n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |      \n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |      \n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |      \n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |      \n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |      \n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |      \n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |      \n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |      \n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |      \n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |      \n",
      " |      Here, we want `exact=False`:\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |      \n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |      \n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |      \n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |      \n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |  \n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |      \n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |      \n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      args : Expr\n",
      " |          A *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |      \n",
      " |      deep : bool, optional\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |      \n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |      \n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |      \n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |      \n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |  \n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |  \n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import S, I\n",
      " |      \n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |      \n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |  \n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |      \n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |      \n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |      \n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |      \n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |      \n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |      \n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |      \n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |      \n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |      \n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |      \n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |      \n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |      \n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |      \n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |      \n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |      \n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |      \n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |      \n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |      \n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |      \n",
      " |      rather than\n",
      " |      \n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |      \n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |  \n",
      " |  xreplace(self, rule)\n",
      " |      Replace occurrences of objects within the expression.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      rule : dict-like\n",
      " |          Expresses a replacement rule\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      xreplace : the result of the replacement\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, pi, exp\n",
      " |      >>> x, y, z = symbols('x y z')\n",
      " |      >>> (1 + x*y).xreplace({x: pi})\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).xreplace({x: pi, y: 2})\n",
      " |      1 + 2*pi\n",
      " |      \n",
      " |      Replacements occur only if an entire node in the expression tree is\n",
      " |      matched:\n",
      " |      \n",
      " |      >>> (x*y + z).xreplace({x*y: pi})\n",
      " |      z + pi\n",
      " |      >>> (x*y*z).xreplace({x*y: pi})\n",
      " |      x*y*z\n",
      " |      >>> (2*x).xreplace({2*x: y, x: z})\n",
      " |      y\n",
      " |      >>> (2*2*x).xreplace({2*x: y, x: z})\n",
      " |      4*z\n",
      " |      >>> (x + y + 2).xreplace({x + y: 2})\n",
      " |      x + y + 2\n",
      " |      >>> (x + 2 + exp(x + 2)).xreplace({x + 2: y})\n",
      " |      x + exp(y) + 2\n",
      " |      \n",
      " |      xreplace does not differentiate between free and bound symbols. In the\n",
      " |      following, subs(x, y) would not change x since it is a bound symbol,\n",
      " |      but xreplace does:\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: y})\n",
      " |      Integral(y, (y, 1, 2*y))\n",
      " |      \n",
      " |      Trying to replace x with an expression raises an error:\n",
      " |      \n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: 2*y}) # doctest: +SKIP\n",
      " |      ValueError: Invalid limits given: ((2*y, 1, 4*y),)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __init_subclass__() from builtins.type\n",
      " |      This method is called when a class is subclassed.\n",
      " |      \n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |  \n",
      " |  class_key() from builtins.type\n",
      " |      Nice order of classes.\n",
      " |  \n",
      " |  fromiter(args, **assumptions) from builtins.type\n",
      " |      Create a new object from an iterable.\n",
      " |      \n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __sympy__\n",
      " |  \n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |      \n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |      \n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Do not override .args() from Basic (so that it is easy to\n",
      " |      change the interface in the future if needed).\n",
      " |  \n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |      \n",
      " |      For example:\n",
      " |      \n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |      \n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |  \n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |  \n",
      " |  expr_free_symbols\n",
      " |  \n",
      " |  free_symbols\n",
      " |      Return from the atoms of self those which are free symbols.\n",
      " |      \n",
      " |      Not all free symbols are ``Symbol``. Eg: IndexedBase('I')[0].free_symbols\n",
      " |      \n",
      " |      For most expressions, all symbols are free symbols. For some classes\n",
      " |      this is not true. e.g. Integrals use Symbols for the dummy variables\n",
      " |      which are bound variables, so Integral has a method to return all\n",
      " |      symbols except those. Derivative keeps track of symbols with respect\n",
      " |      to which it will perform a derivative; those are\n",
      " |      bound variables, too, so it has its own free_symbols method.\n",
      " |      \n",
      " |      Any other method that uses bound variables should implement a\n",
      " |      free_symbols method.\n",
      " |  \n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |      \n",
      " |      The following should hold for all objects::\n",
      " |      \n",
      " |          >> x == x.func(*x.args)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |  \n",
      " |  is_algebraic\n",
      " |  \n",
      " |  is_antihermitian\n",
      " |  \n",
      " |  is_commutative\n",
      " |  \n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |      \n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |  \n",
      " |  is_complex\n",
      " |  \n",
      " |  is_composite\n",
      " |  \n",
      " |  is_even\n",
      " |  \n",
      " |  is_extended_negative\n",
      " |  \n",
      " |  is_extended_nonnegative\n",
      " |  \n",
      " |  is_extended_nonpositive\n",
      " |  \n",
      " |  is_extended_nonzero\n",
      " |  \n",
      " |  is_extended_positive\n",
      " |  \n",
      " |  is_extended_real\n",
      " |  \n",
      " |  is_finite\n",
      " |  \n",
      " |  is_hermitian\n",
      " |  \n",
      " |  is_imaginary\n",
      " |  \n",
      " |  is_infinite\n",
      " |  \n",
      " |  is_integer\n",
      " |  \n",
      " |  is_irrational\n",
      " |  \n",
      " |  is_negative\n",
      " |  \n",
      " |  is_noninteger\n",
      " |  \n",
      " |  is_nonnegative\n",
      " |  \n",
      " |  is_nonpositive\n",
      " |  \n",
      " |  is_nonzero\n",
      " |  \n",
      " |  is_odd\n",
      " |  \n",
      " |  is_polar\n",
      " |  \n",
      " |  is_positive\n",
      " |  \n",
      " |  is_prime\n",
      " |  \n",
      " |  is_rational\n",
      " |  \n",
      " |  is_real\n",
      " |  \n",
      " |  is_transcendental\n",
      " |  \n",
      " |  is_zero\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  is_Add = False\n",
      " |  \n",
      " |  is_AlgebraicNumber = False\n",
      " |  \n",
      " |  is_Atom = False\n",
      " |  \n",
      " |  is_Boolean = False\n",
      " |  \n",
      " |  is_Derivative = False\n",
      " |  \n",
      " |  is_Dummy = False\n",
      " |  \n",
      " |  is_Equality = False\n",
      " |  \n",
      " |  is_Float = False\n",
      " |  \n",
      " |  is_Function = False\n",
      " |  \n",
      " |  is_Indexed = False\n",
      " |  \n",
      " |  is_Integer = False\n",
      " |  \n",
      " |  is_MatAdd = False\n",
      " |  \n",
      " |  is_MatMul = False\n",
      " |  \n",
      " |  is_Matrix = False\n",
      " |  \n",
      " |  is_Mul = False\n",
      " |  \n",
      " |  is_Not = False\n",
      " |  \n",
      " |  is_Number = False\n",
      " |  \n",
      " |  is_NumberSymbol = False\n",
      " |  \n",
      " |  is_Order = False\n",
      " |  \n",
      " |  is_Piecewise = False\n",
      " |  \n",
      " |  is_Point = False\n",
      " |  \n",
      " |  is_Poly = False\n",
      " |  \n",
      " |  is_Pow = False\n",
      " |  \n",
      " |  is_Rational = False\n",
      " |  \n",
      " |  is_Relational = False\n",
      " |  \n",
      " |  is_Symbol = False\n",
      " |  \n",
      " |  is_Vector = False\n",
      " |  \n",
      " |  is_Wild = False\n",
      " |  \n",
      " |  is_symbol = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.printing.defaults.Printable:\n",
      " |  \n",
      " |  __repr__ = __str__(self)\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |  \n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |      \n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |      \n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |      \n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |      \n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |      \n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |      \n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |      \n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |      \n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |      \n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |      \n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |  \n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(ImageSet)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 522,
   "id": "4941c657",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=ImageSet(Lambda(x,2*x+1),Naturals0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 535,
   "id": "624b5f12",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=ImageSet(Lambda(x,3*x+1),Naturals0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 536,
   "id": "d6d67ee2",
   "metadata": {},
   "outputs": [],
   "source": [
    "C=(A-B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 537,
   "id": "37a73cf9",
   "metadata": {},
   "outputs": [],
   "source": [
    "n=0\n",
    "c_list=[]\n",
    "for item in C:\n",
    "    c_list.append(item)\n",
    "    n+=1\n",
    "    if(n>30):\n",
    "        break\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 538,
   "id": "8a32021b",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3,\n",
       " 5,\n",
       " 9,\n",
       " 11,\n",
       " 15,\n",
       " 17,\n",
       " 21,\n",
       " 23,\n",
       " 27,\n",
       " 29,\n",
       " 33,\n",
       " 35,\n",
       " 39,\n",
       " 41,\n",
       " 45,\n",
       " 47,\n",
       " 51,\n",
       " 53,\n",
       " 57,\n",
       " 59,\n",
       " 63,\n",
       " 65,\n",
       " 69,\n",
       " 71,\n",
       " 75,\n",
       " 77,\n",
       " 81,\n",
       " 83,\n",
       " 87,\n",
       " 89,\n",
       " 93]"
      ]
     },
     "execution_count": 538,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 576,
   "id": "276e9c7a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 21$"
      ],
      "text/plain": [
       "21"
      ]
     },
     "execution_count": 576,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c_list[6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 577,
   "id": "e17b6dd2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 89$"
      ],
      "text/plain": [
       "89"
      ]
     },
     "execution_count": 577,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c_list[29]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 539,
   "id": "ecb425c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 110$"
      ],
      "text/plain": [
       "110"
      ]
     },
     "execution_count": 539,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c_list[6]+c_list[29]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 557,
   "id": "d7e8eed9",
   "metadata": {},
   "outputs": [],
   "source": [
    "def starrun(A,B):\n",
    "    return abs(len(A)-len(B))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 558,
   "id": "b79a385f",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=FiniteSet(1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 561,
   "id": "cef057ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "a =symbols(\"a\",real=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 562,
   "id": "9e512d87",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=solveset((x**2+a*x)*(x**2+a*x+2),x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 563,
   "id": "6ee6c014",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{0, - a\\right\\} \\cup \\left(\\mathbb{R} \\cap \\left\\{- \\frac{a}{2} - \\frac{\\sqrt{a^{2} - 8}}{2}, - \\frac{a}{2} + \\frac{\\sqrt{a^{2} - 8}}{2}\\right\\}\\right)$"
      ],
      "text/plain": [
       "Union({0, -a}, Intersection({-a/2 - sqrt(a**2 - 8)/2, -a/2 + sqrt(a**2 - 8)/2}, Reals))"
      ]
     },
     "execution_count": 563,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7caddb78",
   "metadata": {},
   "source": [
    "### 复数与不等式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 578,
   "id": "21bfd344",
   "metadata": {},
   "outputs": [],
   "source": [
    "z = (1-I)/(2+2*I)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 582,
   "id": "08486778",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{i}{2}$"
      ],
      "text/plain": [
       "-I/2"
      ]
     },
     "execution_count": 582,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 581,
   "id": "2d76dfaf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - i$"
      ],
      "text/plain": [
       "-I"
      ]
     },
     "execution_count": 581,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(z-conjugate(z))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 584,
   "id": "a7069e05",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{5}$"
      ],
      "text/plain": [
       "sqrt(5)"
      ]
     },
     "execution_count": 584,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(2+I**2+2*I**3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 585,
   "id": "2aa2d055",
   "metadata": {},
   "outputs": [],
   "source": [
    "z=(2+I)/(1+I**2+I**5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 586,
   "id": "50ed8293",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 1 - 2 i$"
      ],
      "text/plain": [
       "1 - 2*I"
      ]
     },
     "execution_count": 586,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 587,
   "id": "7386107b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle i \\left(2 - i\\right)$"
      ],
      "text/plain": [
       "I*(2 - I)"
      ]
     },
     "execution_count": 587,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "conjugate(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 589,
   "id": "8c594b84",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b = symbols(\"a,b\",real =True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 590,
   "id": "43fbf700",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq = Eq(a+3*I**(-3),(b+I)*I**2023)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 591,
   "id": "8bf4ac97",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle a + 3 i = - i \\left(b + i\\right)$"
      ],
      "text/plain": [
       "Eq(a + 3*I, -I*(b + I))"
      ]
     },
     "execution_count": 591,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 594,
   "id": "00748296",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\left( 1, \\  -3\\right)\\right\\}$"
      ],
      "text/plain": [
       "{(1, -3)}"
      ]
     },
     "execution_count": 594,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nonlinsolve((eq.lhs-eq.rhs).as_real_imag(),[a,b])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 595,
   "id": "ca8fab43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1\\right\\}$"
      ],
      "text/plain": [
       "{1}"
      ]
     },
     "execution_count": 595,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset((a+I)*(1-a*I)-2,a,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 596,
   "id": "789fc8df",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\left( 3, \\  -2\\right)\\right\\}$"
      ],
      "text/plain": [
       "{(3, -2)}"
      ]
     },
     "execution_count": 596,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nonlinsolve(((a+2*I)*I-(b+3*I)).as_real_imag(),[a,b],Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 600,
   "id": "a3c85bd6",
   "metadata": {},
   "outputs": [],
   "source": [
    "z = symbols(\"z\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 601,
   "id": "d84a0503",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\frac{1}{2} - \\frac{i}{2}\\right\\}$"
      ],
      "text/plain": [
       "{1/2 - I/2}"
      ]
     },
     "execution_count": 601,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_complex(1/(1+I)-z,z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 606,
   "id": "4ae4faf7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0.8 - 0.6 i$"
      ],
      "text/plain": [
       "0.8 - 0.6*I"
      ]
     },
     "execution_count": 606,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N((3-I)/(3+I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 607,
   "id": "61061d6c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 1.0 - 1.0 i$"
      ],
      "text/plain": [
       "1.0 - 1.0*I"
      ]
     },
     "execution_count": 607,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N((7+I)/(3+4*I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 609,
   "id": "189a0209",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{10}}{10}$"
      ],
      "text/plain": [
       "sqrt(10)/10"
      ]
     },
     "execution_count": 609,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(-I/(1+3*I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 683,
   "id": "1ed85bb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{3}{10} - \\frac{i}{10}$"
      ],
      "text/plain": [
       "-3/10 - I/10"
      ]
     },
     "execution_count": 683,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(-I/(1+3*I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 611,
   "id": "373d5a13",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(1 - i\\right) \\left(1 + 2 i\\right)$"
      ],
      "text/plain": [
       "(1 - I)*(1 + 2*I)"
      ]
     },
     "execution_count": 611,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr =(1+2*I)*(1-I)\n",
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 612,
   "id": "555da746",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{10}$"
      ],
      "text/plain": [
       "sqrt(10)"
      ]
     },
     "execution_count": 612,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 614,
   "id": "17b61dbb",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 615,
   "id": "287013cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1 + i\\right\\}$"
      ],
      "text/plain": [
       "{1 + I}"
      ]
     },
     "execution_count": 615,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_complex(Eq(I*(1-z),1),z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 616,
   "id": "5a4d691b",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = 1+I"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 617,
   "id": "6294f590",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\sqrt{2}$"
      ],
      "text/plain": [
       "2*sqrt(2)"
      ]
     },
     "execution_count": 617,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(I*expr+3*conjugate(expr))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 618,
   "id": "1c136f23",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1 + i\\right\\}$"
      ],
      "text/plain": [
       "{1 + I}"
      ]
     },
     "execution_count": 618,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve_complex(Eq(2*(z+conjugate(z))+5*(z-conjugate(z)),4+10*I),z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 684,
   "id": "298b001f",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = I*(1-I**2023)/((1-I)*(1+I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 685,
   "id": "61c42b6f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{i \\left(1 - i\\right) \\left(1 + i\\right)^{2}}{4}$"
      ],
      "text/plain": [
       "I*(1 - I)*(1 + I)**2/4"
      ]
     },
     "execution_count": 685,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 687,
   "id": "47630284",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{1}{2} + \\frac{i}{2}$"
      ],
      "text/plain": [
       "-1/2 + I/2"
      ]
     },
     "execution_count": 687,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 686,
   "id": "be3449ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{2}}{2}$"
      ],
      "text/plain": [
       "sqrt(2)/2"
      ]
     },
     "execution_count": 686,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 623,
   "id": "7bc79cfe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{1}{2} + \\frac{i}{2}$"
      ],
      "text/plain": [
       "1/2 + I/2"
      ]
     },
     "execution_count": 623,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify((2-I)/(1-3*I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 624,
   "id": "c91a2614",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr  = (z+2)/(z-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 626,
   "id": "209bb5b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{5}{2} + \\frac{3 i}{2}$"
      ],
      "text/plain": [
       "5/2 + 3*I/2"
      ]
     },
     "execution_count": 626,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(expr.subs(z,2-I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 627,
   "id": "5afaccb3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{10} \\sqrt{a^{2} + 9}}{10}$"
      ],
      "text/plain": [
       "sqrt(10)*sqrt(a**2 + 9)/10"
      ]
     },
     "execution_count": 627,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "abs((a-3*I)/(3+I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 630,
   "id": "cc389843",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{3 a}{10} + i \\left(- \\frac{a}{10} - \\frac{9}{10}\\right) - \\frac{3}{10}$"
      ],
      "text/plain": [
       "3*a/10 + I*(-a/10 - 9/10) - 3/10"
      ]
     },
     "execution_count": 630,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "collect(expand((a-3*I)/(3+I)),I)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 631,
   "id": "4f4f30cb",
   "metadata": {},
   "outputs": [],
   "source": [
    "z1=1+2*I"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 632,
   "id": "f972f622",
   "metadata": {},
   "outputs": [],
   "source": [
    "z2=2-I"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 633,
   "id": "17d1494b",
   "metadata": {},
   "outputs": [],
   "source": [
    "z3=3+z1/z2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 635,
   "id": "ac30d5ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 3 + i$"
      ],
      "text/plain": [
       "3 + I"
      ]
     },
     "execution_count": 635,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(z3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 637,
   "id": "9c8a82d5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{2 - i, 2 + i\\right\\}$"
      ],
      "text/plain": [
       "{2 - I, 2 + I}"
      ]
     },
     "execution_count": 637,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(x**2-4*x+5,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 641,
   "id": "972a1dce",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(1,a,b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 642,
   "id": "5a290aad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle a x + b + x^{2}$"
      ],
      "text/plain": [
       "a*x + b + x**2"
      ]
     },
     "execution_count": 642,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 643,
   "id": "1498dc86",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\mathbb{R} \\cap \\left\\{- \\frac{a}{2} - \\frac{\\sqrt{a^{2} - 4 b}}{2}, - \\frac{a}{2} + \\frac{\\sqrt{a^{2} - 4 b}}{2}\\right\\}$"
      ],
      "text/plain": [
       "Intersection({-a/2 - sqrt(a**2 - 4*b)/2, -a/2 + sqrt(a**2 - 4*b)/2}, Reals)"
      ]
     },
     "execution_count": 643,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.roots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 644,
   "id": "201247a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(1,-4,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 647,
   "id": "1211cf8f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{2 - \\sqrt{2} i, 2 + \\sqrt{2} i\\right\\}$"
      ],
      "text/plain": [
       "{2 - sqrt(2)*I, 2 + sqrt(2)*I}"
      ]
     },
     "execution_count": 647,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(q.equation(x),x,Complexes)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 650,
   "id": "5fea21f4",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAnQAAAHVCAYAAAB4wWYZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABNAUlEQVR4nO3deXxU5d338e9km+yTfYMkLLIlLIawhcWlCopCpbWCbcUFrTf3jS02j30UbbVqK3o/tnWrVCuK1gp438hSFVmqgAiKYALKjiwJISGEJDPZ13n+CBmNwEhCZs5M8nm/XucV5uSak9+Zl8I313Wu6zLZ7Xa7AAAA4LV8jC4AAAAAF4dABwAA4OUIdAAAAF6OQAcAAODlCHQAAABejkAHAADg5Qh0AAAAXo5ABwAA4OUIdE7Y7XbZbDax9jIAAPBkBDonKioqZLFYVFFRYXQpAAAA50WgAwAA8HIEOgAAAC9HoAMAAPByBDoAAAAvR6ADAADwcgQ6AAAAL0egAwAA8HIEOgAAAC9HoAMAAPByBDoAAAAvR6ADAADwcgQ6AAAAL0egAwAA8HIEOgAAAC9HoAMAAPByBDoAAAAvR6ADAADwcgQ6AAAAL+cRgW7+/PkaOXKkwsLCFBcXp2nTpmn//v3f+76NGzcqMzNTgYGB6tOnj/72t7+d1WbZsmVKS0uT2WxWWlqali9f7opbcPjvD/bpllc+045jZS79OQAAAK08ItBt3LhRc+bM0aeffqp169apsbFRkyZNUlVV1Xnfc+TIEV133XWaMGGCcnJy9OCDD+pXv/qVli1b5mizdetWzZgxQzNnztTOnTs1c+ZMTZ8+XZ999pnL7mXXcas2HypRXun5awcAAOhMJrvdbje6iO86deqU4uLitHHjRl122WXnbHP//fdr1apV2rt3r+Pc7NmztXPnTm3dulWSNGPGDNlsNq1evdrR5tprr1VkZKQWL178vXXYbDZZLBZZrVaFh4dfUO1zl+RoZe4J/fb6QbprQp8Leg8AAMDF8Igeuu+yWq2SpKioqPO22bp1qyZNmtTm3DXXXKPt27eroaHBaZstW7ac85p1dXWy2WxtjvaKDjFLkkoq69v9XgAAgI7wuEBnt9uVnZ2t8ePHa/DgwedtV1RUpPj4+Dbn4uPj1djYqJKSEqdtioqKznnN+fPny2KxOI7k5OR21x8dGiBJOl1Z1+73AgAAdITHBbp77rlHu3btuqAhUZPJ1OZ16+jxt8+fq813z7WaN2+erFar48jPz29v+YppDXRV9NABAAD38DO6gG/75S9/qVWrVmnTpk3q2bOn07YJCQln9bQVFxfLz89P0dHRTtt8t9euldlsltlsvog7+GbIlR46AADgLh7RQ2e323XPPffonXfe0YcffqjevXt/73uysrK0bt26NufWrl2rESNGyN/f32mbsWPHdl7x39E65MozdAAAwF08ItDNmTNHb775pt566y2FhYWpqKhIRUVFqqmpcbSZN2+ebr31Vsfr2bNn69ixY8rOztbevXv16quvauHChbrvvvscbebOnau1a9fqqaee0r59+/TUU09p/fr1uvfee112LzGhZ3roqurkgROIAQBAF+QRgW7BggWyWq264oorlJiY6DiWLl3qaFNYWKi8vDzH6969e+v999/Xhg0bdOmll+rxxx/Xc889pxtvvNHRZuzYsVqyZIlee+01DR06VIsWLdLSpUs1evRol91Law9dbUOzquubXPZzAAAAWnnkOnSeoiPr0EnSwN+tVm1Dszb95kqlRAe7sEIAAAAP6aHrahxr0VUxMQIAALgegc4FWpcuKWViBAAAcAMCnQtEf2tiBAAAgKsR6FwgOoSlSwAAgPsQ6FzA0UNHoAMAAG5AoHOBb7b/YsgVAAC4HoHOBVrXoqOHDgAAuAOB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B35fWBbvHixfr973+vpUuXKi4uznF+zJgxuuWWWzRs2DBNmDBBb7/9tvr376/nn3/+vNeaP3++LBaL40hOTnbHLXSYj49JV5xZvmT9npMGVwMAAIzi1YFu6dKluvPOO/X222/r6quvdtrWx8dHI0eOdNpDN2/ePFmtVseRn5/f2SV3uknpLc8IfrC7SHa73eBqAACAEbw20C1evFi333673nrrLV1//fXf295utys3N1eJiYnnbWM2mxUeHt7m8HSX949VoL+PjpfVaPcJzx4iBgAAruERga6yslK5ubnKzc2VJB05ckS5ubnKy8uT1NJzduuttzraL168WLfeeqv+9Kc/acyYMSoqKlJRUZGsVqujzaOPPqo1a9bo8OHDys3N1Z133qnc3FzNnj3brffmakEBvo5dI9buLjK4GgAAYASPCHTbt29XRkaGY8mR7OxsZWRk6OGHH5YkFRYWOsKdJL300ktqbGzUnDlzlJiY6Djmzp3raFNeXq67775bgwYN0qRJk1RQUKBNmzZp1KhR7r05N7h28DfDrgAAoPsx2Xnw6rxsNpssFousVqtHD79aqxuU+Yd1amy268P/c7n6xIYaXRIAAHAjj+ihw8WxBPsrq2+0JGnNbma7AgDQ3RDouohr0hl2BQCguyLQdRGT0uJlMkk788tVaK0xuhwAAOBGBLouIi48UJkpkZKktQy7AgDQrRDoupDWYdc1DLsCANCtEOi6kNZA99mRUpVW1RtcDQAAcJeLCnQNDQ3Kz8/X/v37VVpa2lk1oYNSooOVlhiupma71u9l2BUAgO6i3YGusrJSL730kq644gpZLBb16tVLaWlpio2NVWpqqn7xi1/o888/d0WtuACtiwy/t6vQ4EoAAIC7tCvQ/eUvf1GvXr3097//XT/4wQ/0zjvvKDc3V/v379fWrVv1yCOPqLGxURMnTtS1116rgwcPuqpunMfUYUmSpM2HSnSqos7gagAAgDu0a6eIm266SQ8//LCGDBnitF1dXZ0WLlyogIAA3XXXXRddpFG8ZaeI75r210+Um1+uh6ekadb43kaXAwAAXKzDW39VVFQoLCyss+vxKN4a6F7fclSPrNqtoT0tWnXPeKPLAQAALtbhSRETJkx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xj39sv+WWWwyqqEWnb/3VFdTX12vHjh36wQ9+0Ob8pEmTtGXLFoOq6hx9Y0OV1SdazXbpH58eM7ocr2K1WiVJUVFRBldijKamJi1ZskRVVVXKysoyuhy3mzNnjq6//npdffXVRpdiiIMHDyopKUm9e/fWzTffrMOHDxtdktutWrVKI0aM0E033aS4uDhlZGQ4Hs3pjurr6/Xmm29q1qxZTjeN72rGjx+vf//73zpw4IAkaefOndq8ebPh+9h3eMi1KyspKVFTU9NZS7LEx8erqKjIoKo6z6zxvbX18Gn989NjuufKSxRi5j+D72O325Wdna3x48d3mXUWL9SXX36prKws1dbWKjQ0VMuXL1daWprRZbnVkiVL9MUXX+jzzz83uhRDjB49Wm+88Yb69++vkydP6g9/+IPGjh2r3bt3Kzo62ujy3Obw4cNasGCBsrOz9eCDD2rbtm361a9+JbPZrFtvvdXo8txuxYoVKi8v1+233250KW51//33y2q1auDAgfL19VVTU5P++Mc/6qc//amhdfEvuRPf/Y3Dbrd3id9CrhoYp17RwTp6ulr/u+O4bhvby+iSPN4999yjXbt2afPmzUaX4nYDBgxQbm6uysvLtWzZMt12223auHFjtwl1+fn5mjt3rtauXavAwO65fuO3d/0ZMmSIsrKy1LdvX73++uvKzs42sDL3am5u1ogRI/TEE09IkjIyMrR7924tWLCgWwa6hQsXavLkyUpKSjK6FLdaunSp3nzzTb311ltKT09Xbm6u7r33XiUlJem2224zrC6GXM8hJiZGvr6+OnnyZJvzxcXFio+PN6iqzuPjY9Kd43tLkl795AhLmHyPX/7yl1q1apU++ugj9ezZ0+hy3C4gIECXXHKJRowYofnz52vYsGF69tlnjS7LbXbs2KHi4mJlZmbKz89Pfn5+2rhxo5577jn5+fm1eUC8uwgJCdGQIUN08OBBo0txq8TExLN+kRk0aJDy8vIMqsg4x44d0/r163XXXXcZXYrb/eY3v9EDDzygm2++WUOGDNHMmTP161//WvPnzze0LgLdOQQEBCgzM1MfffRRm/Pr1q3T2LFjDaqqc92Y2VOWIH8dO12t9XtPfv8buiG73a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Ikl69NFHNWbMGPXr1082m03PPfeccnNz9de//tWYmwQAAHARjwh0M2bM0OnTp/XYY4+psLBQgwcP1vvvv6/U1FRJUmFhYZs16V566SU1NjZqzpw5mjNnjuP8bbfdpkWLFkmSysvLdffdd6uoqEgWi0UZGRnatGmTRo0a5dZ7AwAAcDWPWIfOU7EOHQAA8AaGP0MHAACAi0OgAwAA8HIEOgAAAC9HoAMAAPByTIpwwm63q6KiQmFhYRe0awUAAIARCHQAAABejiFXAAAAL0egAwAA8HIEOgAAAC9HoAMAAPByBDoAAAAvR6ADAADwcgQ6AAAAL/f/ARRSGgomsHdhAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<sympy.plotting.plot.Plot at 0x7f8f42611b50>"
      ]
     },
     "execution_count": 650,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(ln(x)/(x-1),(x,0.2,8))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 651,
   "id": "262a515f",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=solveset((x-2)/(x+3)<=0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 652,
   "id": "169b40b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-3, 2\\right]$"
      ],
      "text/plain": [
       "Interval.Lopen(-3, 2)"
      ]
     },
     "execution_count": 652,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 653,
   "id": "0afa488a",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=solveset((x-3)/(x+2)<=0,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 654,
   "id": "600f009f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-2, 3\\right]$"
      ],
      "text/plain": [
       "Interval.Lopen(-2, 3)"
      ]
     },
     "execution_count": 654,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 655,
   "id": "5c4c90c3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-2, 2\\right]$"
      ],
      "text/plain": [
       "Interval.Lopen(-2, 2)"
      ]
     },
     "execution_count": 655,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Intersection(A,B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 656,
   "id": "00ebf704",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = 1/x+4/(3-x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 657,
   "id": "a5e0ca94",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[3, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval(3, oo)"
      ]
     },
     "execution_count": 657,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_range(expr,x,Interval.open(0,3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 658,
   "id": "a0e81eb6",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=4/y+y/x**2+2*x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 659,
   "id": "88ea78d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 x + \\frac{4}{y  } + \\frac{y  }{x^{2}}$"
      ],
      "text/plain": [
       "2*x + 4/y   + y  /x**2"
      ]
     },
     "execution_count": 659,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 660,
   "id": "20564898",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 - \\frac{2 y  }{x^{3}}$"
      ],
      "text/plain": [
       "2 - 2*y  /x**3"
      ]
     },
     "execution_count": 660,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff(expr,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 663,
   "id": "34e73ab2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{6 y  }{x^{4}}$"
      ],
      "text/plain": [
       "6*y  /x**4"
      ]
     },
     "execution_count": 663,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff(expr,x,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 661,
   "id": "e0fbb413",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{4}{y  ^{2}} + \\frac{1}{x^{2}}$"
      ],
      "text/plain": [
       "-4/y  **2 + x**(-2)"
      ]
     },
     "execution_count": 661,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff(expr,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 662,
   "id": "3226111b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{8}{y  ^{3}}$"
      ],
      "text/plain": [
       "8/y  **3"
      ]
     },
     "execution_count": 662,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff(expr,y,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 664,
   "id": "83790435",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=exp(x)-y*ln(x*y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 665,
   "id": "ff3d2951",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - y   \\log{\\left(x y   \\right)} + e^{x}$"
      ],
      "text/plain": [
       "-y  *log(x*y  ) + exp(x)"
      ]
     },
     "execution_count": 665,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 669,
   "id": "5b66c74b",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer=list(solveset(diff(expr,x),y))[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 670,
   "id": "45abde4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - x e^{x} \\log{\\left(x^{2} e^{x} \\right)} + e^{x}$"
      ],
      "text/plain": [
       "-x*exp(x)*log(x**2*exp(x)) + exp(x)"
      ]
     },
     "execution_count": 670,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.subs(y,answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 671,
   "id": "af003176",
   "metadata": {},
   "outputs": [],
   "source": [
    "check=simplify(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 672,
   "id": "26fe27d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(- x \\left(x + \\log{\\left(x^{2} \\right)}\\right) + 1\\right) e^{x}$"
      ],
      "text/plain": [
       "(-x*(x + log(x**2)) + 1)*exp(x)"
      ]
     },
     "execution_count": 672,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 675,
   "id": "4be867fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(2*(x-1)**2+4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 676,
   "id": "cf9d3013",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 x^{2} - 4 x + 6$"
      ],
      "text/plain": [
       "2*x**2 - 4*x + 6"
      ]
     },
     "execution_count": 676,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "56028767",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=symbols(\"a\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "6b230a0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(a*(x-1)**2+12-4*a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "9236d53d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle a x^{2} - 2 a x - 3 a + 12$"
      ],
      "text/plain": [
       "a*x**2 - 2*a*x - 3*a + 12"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "73386794",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(0, 3\\right]$"
      ],
      "text/plain": [
       "Interval.Lopen(0, 3)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(q.delta<=0,a,Interval.Lopen(0,oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "3d6c3033",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{4}{3 - x} + \\frac{1}{x}$"
      ],
      "text/plain": [
       "4/(3 - x) + 1/x"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr=1/x+4/(3-x)\n",
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "53d4794b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(3, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval.open(3, oo)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_range(expr,x,Interval.open(1,3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "59fdbcb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1 - \\frac{\\sqrt{3}}{2}, \\frac{\\sqrt{3}}{2} + 1\\right\\}$"
      ],
      "text/plain": [
       "{1 - sqrt(3)/2, sqrt(3)/2 + 1}"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(1-4*x*(2-x),x,Reals)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fe2dd283",
   "metadata": {},
   "source": [
    "### 第三章"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "c7acaef1",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([1,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "d630074c",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([1,-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "c9452346",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left(1 - x\\right) \\left(1 - y\\right) + \\left(x + 1\\right) \\left(y + 1\\right)\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([[(1 - x)*(1 - y) + (x + 1)*(y + 1)]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(A+x*B).T*(A+y*B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "52c44512",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([3,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "6ba06298",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([2,2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "89e22bc8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}5\\\\3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[5],\n",
       "[3]])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A+B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "f51a1dcf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1\\\\-1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[ 1],\n",
       "[-1]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A-B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "f0bf2e49",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Point(1,-2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "05a30b80",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Point(2,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "1608e229",
   "metadata": {},
   "outputs": [],
   "source": [
    "C=Point(3,-3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "b4aa6e06",
   "metadata": {},
   "outputs": [],
   "source": [
    "D=Point(-1,-6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "520cedc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "AB=B-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "993fbd1f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(1, 2\\right)$"
      ],
      "text/plain": [
       "Point2D(1, 2)"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "2b29541c",
   "metadata": {},
   "outputs": [],
   "source": [
    "AC=C-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "6745f85c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(2, -1\\right)$"
      ],
      "text/plain": [
       "Point2D(2, -1)"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "e0753c6f",
   "metadata": {},
   "outputs": [],
   "source": [
    "AD=D-A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "78e1fb88",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(-2, -4\\right)$"
      ],
      "text/plain": [
       "Point2D(-2, -4)"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "6c15182d",
   "metadata": {},
   "outputs": [],
   "source": [
    "BD=D-B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "45710861",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\operatorname{Point2D}\\left(-3, -6\\right)$"
      ],
      "text/plain": [
       "Point2D(-3, -6)"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "d530c236",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([7*sin(x)-1,5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "c2f5b034",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([1,-(cos(x))**2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "33805803",
   "metadata": {},
   "outputs": [],
   "source": [
    "check=list(A.T*B)[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "418035f4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 7 \\sin{\\left(x \\right)} - 5 \\cos^{2}{\\left(x \\right)} - 1$"
      ],
      "text/plain": [
       "7*sin(x) - 5*cos(x)**2 - 1"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "c4d2a0f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=check.subs(cos(x)**2,1-sin(x)**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "93bdb80e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 5 \\sin^{2}{\\left(x \\right)} + 7 \\sin{\\left(x \\right)} - 6$"
      ],
      "text/plain": [
       "5*sin(x)**2 + 7*sin(x) - 6"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "ed7e00c0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2, \\frac{3}{5}\\right\\}$"
      ],
      "text/plain": [
       "{-2, 3/5}"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(expr,sin(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "76685ceb",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([m,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "c57daf5a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}m\\\\3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[m],\n",
       "[3]])"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "4324e35e",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([1,m+1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "885077b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}4 m + 3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([[4*m + 3]])"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.T*B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "170dd8f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([-2,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "aa9baf50",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([1,t])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "4aef4ff3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left(1 - t\\right) \\left(t + 1\\right) + 3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([[(1 - t)*(t + 1) + 3]])"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(A+B).T*(A-B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "bb9be148",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=(x+3*y)*(2*x-y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "0f5905d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 x^{2} + 5 x y - 3 y^{2}$"
      ],
      "text/plain": [
       "2*x**2 + 5*x*y - 3*y**2"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "3f2bfdb9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{- \\frac{3}{2}, 1\\right\\}$"
      ],
      "text/plain": [
       "{-3/2, 1}"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Poly.from_list([2,1,-3],x).as_expr(),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "22f61aa1",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Matrix([6,2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "9fc05e61",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Matrix([2,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "2b9d508e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}6\\\\0\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[6],\n",
       "[0]])"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "((A.T*B)[0]/(B.T*B)[0])*B"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cc02299b",
   "metadata": {},
   "source": [
    "### 核红"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "a2514ce3",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(((10-3*t)/4)**2-10+3*t+t**2-4*t+25,x=t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "df9b33cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{25 \\left(x - \\frac{38}{25}\\right)^{2}}{16} + \\frac{441}{25}$"
      ],
      "text/plain": [
       "25*(x - 38/25)**2/16 + 441/25"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.symmetry_equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "0d0754e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "c=Circle(Point(4,0),sqrt(2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "01dcc911",
   "metadata": {},
   "outputs": [],
   "source": [
    "l=Line(y-x-m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "76941ad4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - m - x + y$"
      ],
      "text/plain": [
       "-m - x + y"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "bf9f29ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle m^{2} + 2 x^{2} + x \\left(2 m - 8\\right) + 14$"
      ],
      "text/plain": [
       "m**2 + 2*x**2 + x*(2*m - 8) + 14"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "line_and_quadratic(l,c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "d5ad7da6",
   "metadata": {},
   "outputs": [],
   "source": [
    "q=QuadraticFunction(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "1f26dc0d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 8 m^{2} + \\left(2 m - 8\\right)^{2} - 112$"
      ],
      "text/plain": [
       "-8*m**2 + (2*m - 8)**2 - 112"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q.delta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "45a4d93b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-6, -2\\right)$"
      ],
      "text/plain": [
       "Interval.open(-6, -2)"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(_>0,m,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "faa42e99",
   "metadata": {},
   "outputs": [],
   "source": [
    "hyper=Hyperbola(Point(0,0),1,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "53b4908e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} - y^{2} - 1$"
      ],
      "text/plain": [
       "x**2 - y**2 - 1"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hyper.equation()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "69e45b22",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\operatorname{Point2D}\\left(- \\frac{m^{2} + 1}{2 m}, \\frac{\\left(m - 1\\right) \\left(m + 1\\right)}{2 m}\\right)\\right\\}$"
      ],
      "text/plain": [
       "{Point2D(-(m**2 + 1)/(2*m), (m - 1)*(m + 1)/(2*m))}"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Intersection(l,hyper)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "03b00931",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{\\left(-4 - \\frac{m^{2} + 1}{2 m}\\right)^{2} + \\frac{\\left(m - 1\\right)^{2} \\left(m + 1\\right)^{2}}{4 m^{2}}}$"
      ],
      "text/plain": [
       "sqrt((-4 - (m**2 + 1)/(2*m))**2 + (m - 1)**2*(m + 1)**2/(4*m**2))"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(_)[0].distance(c.center)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "8d4047ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{m^{2}}{2} + 4 m + 16 + \\frac{4}{m} + \\frac{1}{2 m^{2}}$"
      ],
      "text/plain": [
       "m**2/2 + 4*m + 16 + 4/m + 1/(2*m**2)"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify((_)**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "3e1789ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - m^{2} - 2 m x - 1$"
      ],
      "text/plain": [
       "-m**2 - 2*m*x - 1"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "line_and_quadratic(l,hyper)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "653b81af",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
